From a303d6e1b73038fb6094edc31244740dcf6a6020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sun, 7 Feb 2021 15:41:51 +0100 Subject: [PATCH] tools: Show line number when CSV parsing fails --- tools/util/utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/util/utils.py b/tools/util/utils.py index 67240915..75295f03 100644 --- a/tools/util/utils.py +++ b/tools/util/utils.py @@ -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],