Skip to content

Raise FileNotFoundError from OAuthToken.from_json on missing path#956

Open
SAY-5 wants to merge 1 commit into
sigma67:mainfrom
SAY-5:fix-oauthtoken-from-json-missing-file
Open

Raise FileNotFoundError from OAuthToken.from_json on missing path#956
SAY-5 wants to merge 1 commit into
sigma67:mainfrom
SAY-5:fix-oauthtoken-from-json-missing-file

Conversation

@SAY-5

@SAY-5 SAY-5 commented Jul 10, 2026

Copy link
Copy Markdown

Fixes #954.

OAuthToken.from_json read file_pack outside the if file_path.is_file() guard, so a missing path fell through to return cls(**file_pack) and raised UnboundLocalError instead of something meaningful. Dropping the guard lets open() raise FileNotFoundError naming the path, which is what callers expect. Added a regression test.

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
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.

OAuthToken.from_json raises UnboundLocalError instead of FileNotFoundError when path missing

1 participant