LogReader: improve error messages (#32747)
* better error messages * clean up old-commit-hash: 3ede1e2a7c850622beef2549315f320aa018105a
This commit is contained in:
@@ -166,7 +166,8 @@ def get_invalid_files(files):
|
||||
|
||||
def check_source(source: Source, *args) -> LogPaths:
|
||||
files = source(*args)
|
||||
assert next(get_invalid_files(files), False) is False
|
||||
assert len(files) > 0, "No files on source"
|
||||
assert not any(get_invalid_files(files)), f"Invalid files: {files}"
|
||||
return files
|
||||
|
||||
|
||||
@@ -175,7 +176,7 @@ def auto_source(sr: SegmentRange, mode=ReadMode.RLOG) -> LogPaths:
|
||||
return comma_car_segments_source(sr, mode)
|
||||
|
||||
SOURCES: list[Source] = [internal_source, openpilotci_source, comma_api_source, comma_car_segments_source,]
|
||||
exceptions = []
|
||||
exceptions = {}
|
||||
|
||||
# for automatic fallback modes, auto_source needs to first check if rlogs exist for any source
|
||||
if mode in [ReadMode.AUTO, ReadMode.AUTO_INTERACTIVE]:
|
||||
@@ -190,9 +191,10 @@ def auto_source(sr: SegmentRange, mode=ReadMode.RLOG) -> LogPaths:
|
||||
try:
|
||||
return check_source(source, sr, mode)
|
||||
except Exception as e:
|
||||
exceptions.append(e)
|
||||
exceptions[source.__name__] = e
|
||||
|
||||
raise Exception(f"auto_source could not find any valid source, exceptions for sources: {exceptions}")
|
||||
raise Exception("auto_source could not find any valid source, exceptions for sources:\n - " +
|
||||
"\n - ".join([f"{k}: {repr(v)}" for k, v in exceptions.items()]))
|
||||
|
||||
|
||||
def parse_useradmin(identifier: str):
|
||||
|
||||
Reference in New Issue
Block a user