How to catch a Firebase Auth specific exceptions

前端 未结 16 2342
慢半拍i
慢半拍i 2020-11-28 04:37

Using Firebase, how do I catch a specific exception and tell the user gracefully about it? E.g :

FirebaseAuthInvalidCredentialsException: The email ad

16条回答
  •  情话喂你
    2020-11-28 05:20

    You should use ((FirebaseAuthException)task.getException()).getErrorCode() to get the type of error and fail gracefully if this is the error code for a bad formatted email.

    Unfortunately, I couldn't find the list of error codes used by Firebase. Trigger the exception once, note the error code and code accordingly.

提交回复
热议问题