auth icon indicating copy to clipboard operation
auth copied to clipboard

Adding error codes to ApiError

Open samirergaibi opened this issue 2 years ago • 36 comments

Feature request

Is your feature request related to a problem? Please describe.

I am building a website with supabase and the errors that is returned from supabase.auth only contains a general error code 400 and a message in english. This makes the different errors hard to distinguish from eachother.

Example: User tries to create an account but the user is already registered so the error returned from supabase.auth.signUp will be

{ 
  message: "User already registered",
  status: 400
}

Describe the solution you'd like

If the error included a specific error code mapped to particular error then providing a custom message would be easy.

Example:

{ 
  message: "User already registered",
  status: 400,
  errorCode: 1,
}

It would also be really awesome if the error codes was included in the documentation.

Describe alternatives you've considered

I've considered checking the string value returned in the error but if that would change in the future that would in turn break the application.

samirergaibi avatar Feb 06 '22 15:02 samirergaibi