tools: Show line number when CSV parsing fails

This commit is contained in:
Léo Lam 2021-02-07 15:41:51 +01:00
parent 7e6fc1d352
commit a303d6e1b7
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
1 changed files with 6 additions and 2 deletions

View File

@ -64,8 +64,12 @@ def get_functions(path: tp.Optional[Path] = None) -> tp.Iterable[FunctionInfo]:
if path is None:
path = get_functions_csv_path()
with path.open() as f:
for row in csv.reader(f):
yield parse_function_csv_entry(row)
reader = csv.reader(f)
for row in reader:
try:
yield parse_function_csv_entry(row)
except ValueError as e:
raise Exception(f"Failed to parse line {reader.line_num}") from e
def add_decompiled_functions(new_matches: tp.Dict[int, str],