fix(auth): adds missing EMAIL_NOT_FOUND error code by bojeil-google · Pull Request #550 · firebase/firebase-admin-python

@bojeil-google

Catch EMAIL_NOT_FOUND and translate to EmailNotFoundError when /accounts:sendOobCode is called for password reset on a user that does not exist.

@bojeil-google

Catch EMAIL_NOT_FOUND and translate to EmailNotFoundError  when /accounts:sendOobCode is called for password reset on a user that does not exist.

lahirumaramba

Choose a reason for hiding this comment

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

Thank you @bojeil-google !
LGTM. Please add a TW to review the reference doc changes.

hiranya911

Choose a reason for hiding this comment

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

One possible typo. Can we also add a test case? Similar to:

def test_get_user_non_existing(self, user_mgt_app):

Raises:
ValueError: If the provided arguments are invalid
UserNotFoundError: If no user exists by the specified email address.

Choose a reason for hiding this comment

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

Should be EmailNotFoundError?

Choose a reason for hiding this comment

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

Unfortunately, this is the problem. They throw different errors. For password reset, they throw EMAIL_NOT_FOUND. For email verification, they throw USER_NOT_FOUND.

Choose a reason for hiding this comment

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

Ah, fair enough 👍

@bojeil-google

@bojeil-google

@bojeil-google

hiranya911

Choose a reason for hiding this comment

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

Thanks. LGTM!

egilmorez

Choose a reason for hiding this comment

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

LG, one tiny nit.


Raises:
ValueError: If the provided arguments are invalid
EmailNotFoundError: If no user exists by the specified email address.

Choose a reason for hiding this comment

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

Is there a specific reason to use "by" here?

I'd expect "for" probably, here and below.

Choose a reason for hiding this comment

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

Thanks for catching. I copied and pasted blindly. It is fixed now here and elsewhere.

@bojeil-google