auth icon indicating copy to clipboard operation
auth copied to clipboard

Add well-defined error codes

Open ryansburgoyne opened this issue 2 years ago • 6 comments

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 avatar Dec 01 '22 20:12 ryansburgoyne

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).

ryansburgoyne avatar Dec 01 '22 20:12 ryansburgoyne

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.

hf avatar Dec 20 '22 14:12 hf

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.

acomanescu avatar Oct 12 '23 23:10 acomanescu

Working on it, main PR here: #1377

hf avatar Jan 19 '24 15:01 hf

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

FatumaA avatar Apr 15 '24 10:04 FatumaA

yes you can close

Em seg., 15 de abr. de 2024 às 07:58, Fatuma Abdullahi < @.***> escreveu:

It appears @hf https://github.com/hf PR was merged, shouldn't this issue be closed then?

— Reply to this email directly, view it on GitHub https://github.com/supabase/auth/issues/842#issuecomment-2056550054, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQH3JUIDWJLDYH3OL3NCG6LY5OXG5AVCNFSM6AAAAAASRFKETGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJWGU2TAMBVGQ . You are receiving this because you commented.Message ID: @.***>

NuvensCorporation avatar Apr 15 '24 17:04 NuvensCorporation