A
A
Arman Dendibaev2019-10-17 09:13:39
JavaScript
Arman Dendibaev, 2019-10-17 09:13:39

How to handle error code from firebase to js?

5da805b5d2418084608148.png
Firebase returns an error code such as:

  • EMAIL_EXISTS: This mail already exists
  • EMAIL_NOT_FOUND: No such mail or deleted
  • INVALID_PASSWORD: Invalid password.
  • USER_DISABLED: Account disabled by admin

How to process them through js/axios
I want to display a block/notification called Errors

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Neverov, 2019-10-17
@TTATPuOT

Process the server response as usual. Check if the status is !== 200, then throw an error with the values ​​from the response:
According to the error codes, you can add your own error classes to make them more convenient to handle.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question