From b059c323c4bb3044bec5d83176d5fb91f974ddae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Horv=C3=A1t?= Date: Mon, 14 Apr 2025 14:32:31 +0200 Subject: [PATCH] fix(check-licenses): print message on exceptions while loading a file --- scripts/check_licenses.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/check_licenses.py b/scripts/check_licenses.py index 5322b4b47..7307ecfe5 100755 --- a/scripts/check_licenses.py +++ b/scripts/check_licenses.py @@ -24,9 +24,17 @@ async def validate_file(path: pathlib.Path) -> int: """Validate a single file.""" checks = 0 errors = 0 - records = await asyncio.get_event_loop().run_in_executor( - None, lambda p: json.loads(open(p, "rb").read()), path - ) + + try: + records = await asyncio.get_event_loop().run_in_executor( + None, lambda p: json.loads(open(p, "rb").read()), path + ) + + except Exception as e: + message = f"Failed to load {path.name} because of {type(e).__name__}: {e}" + + logging.error(message) + raise e for record in records: if rec_licenses := record.get("license"):