nhorvath / Pyrebase4

A simple python wrapper for the Firebase API. ⛺
248 stars 61 forks source link

Documentation on returned error messages #38

Open frankhuurman opened 2 years ago

frankhuurman commented 2 years ago

Hi there,

I've been using pyrebase4 for some time and was digging through the pyrebase documentation and the docs on the firebase website but haven't been able to find a list of possible error messages that could be returned.

Take this example for instance:

try:
      result = self.auth.sign_in_with_email_and_password(email, password)
except requests.HTTPError as e:
      error_json = e.args[1]
      error = json.loads(error_json)['error']['message']
      if error == "INVALID_PASSWORD":
          print("Password is invalid")
      if error == "EMAIL_NOT_VALID":
          print("No account found with this e-mail")

I had to find out by entering a wrong password that the error message "INVALID_PASSWORD" is returned and did another request with a non existing e-mail address to receive "EMAIL_NOT_VALID". If anyone could steer me in the direction of a list of these returned values per auth function then it would save me a lot of time trying out all kinds of requests to see what exact error message gets returned to write exceptions for them. Putting these in the Pyrebase docs would be massively helpful as well! 😄

Thanks in advance.

Make sure these boxes are checked before submitting your issue:

[x] Check that your version of Python is 3.4+ [x] Check that you are on the newest version of Pyrebase [x] Check that Email/password provider is enabled in your Firebase dashboard under Auth -> Sign In Method.

Please don't be discouraged if you do not get a response to your issue quickly, I maintain Pyrebase for fun and don't always have as much free time as I'd like.

Thank you for helping make Pyrebase better!