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

[FEAT] Handling client errors #506

Closed
1 task
jmensch1 opened this issue Apr 6, 2020 · 0 comments · Fixed by #682
Closed
1 task

[FEAT] Handling client errors #506

jmensch1 opened this issue Apr 6, 2020 · 0 comments · Fixed by #682
Assignees
Labels
Role: Backend Related to API or other server-side work v1 The first version of the site

Comments

@jmensch1
Copy link
Contributor

jmensch1 commented Apr 6, 2020

Overview

When the frontend hits the api with invalid parameters, like a missing startDate or a string where an integer is expected, the backend responds in one of two ways:

  • a 500 error, with a generic message like "The server encountered an internal error and cannot complete your request." This doesn't help the frontend figure out what went wrong.
  • a 200 response that contains an error message in the JSON (like {"Error": "a start date is required"}). In this case, the message is helpful but the frontend's api infrastructure (axios/redux saga) doesn't know that the response is an error because it has a status code of 200.

Action Items

  • Return 400 errors with helpful messages whenever the frontend submits invalid params to the api.

Resources/Instructions

https://sanic.readthedocs.io/en/latest/sanic/exceptions.html

@jmensch1 jmensch1 added the Role: Backend Related to API or other server-side work label Apr 6, 2020
@jmensch1 jmensch1 added this to the 311 Data Alpha - Dev Complete milestone Apr 6, 2020
@jmensch1 jmensch1 self-assigned this Apr 12, 2020
@jmensch1 jmensch1 mentioned this issue Jun 9, 2020
4 tasks
@jmensch1 jmensch1 linked a pull request Jun 9, 2020 that will close this issue
4 tasks
@Rabia2219 Rabia2219 added the v1 The first version of the site label Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Role: Backend Related to API or other server-side work v1 The first version of the site
Projects
Development

Successfully merging a pull request may close this issue.

3 participants