fix(cli): catch OAuth error in register-webapp - #575
Merged
Conversation
Member
|
Thank you. I think error handling in the CLI is a bit weak in general, maybe at some point making use of Cyclopts error handling https://cyclopts.readthedocs.io/en/latest/app_calling.html#exception-handling-and-exiting would make sense. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bfabric-cli auth register-webappcrashed with a raw Python traceback when the OAuth session's refresh token was expired/revoked, instead of printing a clean error like the rest of the command.client.auth.password.get_secret_value()(the call that triggers a token refresh) sat outside any try/except, so theBfabricOAuthErrorraised bycredential_provider.pyhad no local handler and propagated past__main__.py's bareapp()call.Error: ...and exits 1.Test plan
credential_provider._ensure_tokenraisesBfabricOAuthError(aRuntimeError) oninvalid_grant; the new try/except inregister_webapp.pycatches it and prints a clean message instead of a traceback.bfabric-cli auth register-webappnow printsError: OAuth session expired (...)and exits 1 instead of a traceback.