Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Google Drive] Permissions: catch ExternalOauthTokenError on oauth #11461

Merged
merged 3 commits into from
Mar 19, 2025

Conversation

philipperolet
Copy link
Contributor

Description

Fixes logs such as this one

ExternalOauthTokenError should be caught and not trigger an unhandled error. It is already the case for most calls, but in Google Drive retrievePermissions there was an uncaught one.

Risks

low

Deploy

connectors

@philipperolet philipperolet requested a review from PopDaph March 19, 2025 09:25
Copy link
Contributor

@PopDaph PopDaph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving as is but I wonder if would not be better to revert this change and instead move the line const authCredentials = await getAuthObject(c.connectionId); from line 250 to line 275 as first instruction of the existing try, where this error is already caught so it's centralized. WDYT?

@philipperolet
Copy link
Contributor Author

Approving as is but I wonder if would not be better to revert this change and instead move the line const authCredentials = await getAuthObject(c.connectionId); from line 250 to line 275 as first instruction of the existing try, where this error is already caught so it's centralized. WDYT?

Hadn't seen that, well spotted.
I personally prefer very small try catch blocks: more understandable when you read, where and what the code is trying to protect. Furthermore, when there's an issue on a non-rethrown error, you can easierly pinpoint what went wrong in the block.

Buuut... consistently bad is better than inconsistently good 😉 + less code, so going forward with your suggestion

@philipperolet philipperolet merged commit a7b656b into main Mar 19, 2025
6 checks passed
@philipperolet philipperolet deleted the fix-oauth-token branch March 19, 2025 09:47
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.

2 participants