-
Notifications
You must be signed in to change notification settings - Fork 1
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
How to handle errors in API? #195
Comments
When working on the frontend, I think it's really helpful to get proper status codes for different types of errors. When I'm still working on the code, I also appreciate if there is some error message sent in the json response that indicates what went wrong. That's more for my own purpose though. I don't show these API-messages to the user but rather have a separate message to the user in the frontend-code. That can be due to language reasons (API sends message in English, website is in Swedish) or because I want to phrase it in a nicer/more helpful way. |
Yes, this was probably unclear. Right now, I think there's a mix; some endpoints return errors akin to jsonapi, some set the return code indicating error on error or return value and some return an empty/null JSON object on error (but a 200). There should definitely be sensible return codes, no matter how we pass them. |
Refactor standardize the way error propagation in backend, |
How do we want to handle errors from the API, e.g. signal through HTTP codes (e.g. 403), an empty answer or always do json with a status that is always filled in?
The text was updated successfully, but these errors were encountered: