Skip to content

Conversation

janpaepke
Copy link

Without await, this will never actually catch the error in the try/catch block, but return the (rejected) promise.

Without await, this will never actually catch the error in the try/catch block, but return the (rejected) promise.
Copy link

google-cla bot commented Feb 11, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link

@0x-cosmos 0x-cosmos left a comment

Choose a reason for hiding this comment

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

LGTM, and this would have saved me 5 minutes of debugging.

@@ -22,7 +22,7 @@ export async function signInWithGoogle() {

export async function signOut() {
try {
return auth.signOut();
await auth.signOut();
Copy link

@tusharsinghal1610 tusharsinghal1610 Aug 24, 2025

Choose a reason for hiding this comment

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

In original code, we were returning the result "return auth.signOut();"
should we do instead "return await auth.signOut();" ? just for consistency of return value.

Copy link
Author

Choose a reason for hiding this comment

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

We could, but auth.signOut() returns Promise<void>, so noone should be using the return value anyway.
Additionally the signIn function (signInWithGoogle()) also does not return the value, but simply awaits it.
One might even argue that simply awaiting without returning is more explicit about the intent of this not returning anything.

But ultimately this is a question of taste, so if you like, I can change it...

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.

3 participants