Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add well-defined error codes #842

Closed
ryansburgoyne opened this issue Dec 1, 2022 · 6 comments
Closed

Add well-defined error codes #842

ryansburgoyne opened this issue Dec 1, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@ryansburgoyne
Copy link

Feature request

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

Currently it appears that errors from GoTrue only contain a single property, msg, which describes the error. While I could show this message to my users, it would not be localized, and may not match the tone of my app.

Describe the solution you'd like

I would like it if there were well-documented specific error codes (beyond the HTTP error codes) like PASSWORD_TOO_SHORT or EMAIL_EXISTS included in error payloads so that I could create my own error messages to present to the user on the application side.

Describe alternatives you've considered

I could match against the existing msg strings, but that seems error-prone and likely to be broken when the language in those strings is updated.

@ryansburgoyne ryansburgoyne added the enhancement New feature or request label Dec 1, 2022
@ryansburgoyne
Copy link
Author

After further development, I've discovered that some errors do include error codes (GoTrueError(message: nil, msg: nil, code: nil, error: Optional("invalid_grant"), errorDescription: Optional("Invalid login credentials")) while others do not (GoTrueError(message: nil, msg: Optional("Password should be at least 6 characters"), code: Optional(422), error: nil, errorDescription: nil).

@hf
Copy link
Contributor

hf commented Dec 20, 2022

This is a known issue and one we're very aware of. It is likely to be one of our biggest priorities in the next year. We'll keep you updated on this issue.

@acomanescu
Copy link

Any news on this topic? I'm building a Rust app and it's extremely confusing what the API error messages come in different shapes.

@hf
Copy link
Contributor

hf commented Jan 19, 2024

Working on it, main PR here: #1377

@FatumaA
Copy link

FatumaA commented Apr 15, 2024

It appears @hf PR was merged, shouldn't this issue be closed then?

@NuvensCorporation
Copy link

NuvensCorporation commented Apr 15, 2024 via email

@J0 J0 closed this as completed Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants