Skip to content

fix: replace bare excepts with specific types in API key caching#15

Open
haosenwang1018 wants to merge 1 commit intoNVlabs:mainfrom
haosenwang1018:fix/bare-excepts-llm-call
Open

fix: replace bare excepts with specific types in API key caching#15
haosenwang1018 wants to merge 1 commit intoNVlabs:mainfrom
haosenwang1018:fix/bare-excepts-llm-call

Conversation

@haosenwang1018
Copy link
Copy Markdown

Replace bare except: with except (FileNotFoundError, json.JSONDecodeError, KeyError): in LLM_CALL.py (2 sites).

Both handle cached API key loading where the file may not exist, contain invalid JSON, or lack expected keys. The specific exception types cover all expected failure modes while allowing system exceptions (KeyboardInterrupt, SystemExit) to propagate.

Changes: LLM_CALL.py lines 230, 256

Both sites handle cached API key loading where the file may not exist,
contain invalid JSON, or lack expected keys. Replace bare `except:` with
`except (FileNotFoundError, json.JSONDecodeError, KeyError):` to catch
only expected failure modes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant