bito-code-review[bot] commented on code in PR #42644:
URL: https://github.com/apache/superset/pull/42644#discussion_r3727841630
##########
superset/utils/oauth2.py:
##########
@@ -164,23 +168,24 @@ def refresh_oauth2_token(
except db_engine_spec.oauth2_exception as ex:
# OAuth token is no longer valid, delete it and start OAuth2 dance
logger.warning(
- "OAuth2 token refresh failed for user=%s db=%s, "
- "deleting token. Error: %s",
- user_id,
+ "OAuth2 token refresh failed: database_id=%s engine=%s
error_type=%s; "
+ "deleting token",
database_id,
- ex,
+ db_engine_spec.engine,
+ type(ex).__name__,
)
db.session.delete(token)
db.session.flush()
- raise
- except Exception:
- # non-OAuth related failure, log the exception
- logger.warning(
- "OAuth2 token refresh failed for user=%s db=%s",
- user_id,
+ raise OAuth2TokenRefreshError() from None
+ except Exception as ex:
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Avoid catching blind Exception</b></div>
<div id="fix">
The bare `except Exception` clause catches all exceptions. Consider catching
specific exceptions or handling different exception types separately. Other
similar blind catches exist in the file if applicable.
</div>
</div>
<small><i>Code Review Run #238c06</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]