You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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:
{"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
Resources/Instructions
https://sanic.readthedocs.io/en/latest/sanic/exceptions.html
The text was updated successfully, but these errors were encountered: