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

Implement JSON error code handling #569

Open
kozabrada123 opened this issue Oct 13, 2024 · 1 comment
Open

Implement JSON error code handling #569

kozabrada123 opened this issue Oct 13, 2024 · 1 comment
Labels
Module: API Priority: Medium Type: Enhancement Enhances an existing feature or behaviour.

Comments

@kozabrada123
Copy link
Member

from https://docs.discord.sex/topics/opcodes-and-status-codes#json:

Along with the HTTP error code, the API can also return more detailed error codes through a code key in the JSON error response. The response will also contain a message key containing a more friendly error string. Some of these errors may include additional details in the form of Error Messages provided by an errors object.

This can help narrow down the error, for example in POST /users/@me/mfa/totp/enable:

{
    "message": "Invalid two-factor secret",
    "code": 60005
}

vs

{
    "message": "Password does not match",
    "code": 50018
}
@kozabrada123 kozabrada123 added Priority: Medium Type: Enhancement Enhances an existing feature or behaviour. Module: API labels Oct 13, 2024
@kozabrada123 kozabrada123 changed the title Implmenet JSON error code handling Implement JSON error code handling Oct 13, 2024
@bitfl0wer
Copy link
Member

symfonia should also implement this. I am going to create an issue there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Module: API Priority: Medium Type: Enhancement Enhances an existing feature or behaviour.
Projects
None yet
Development

No branches or pull requests

2 participants