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
You're already using 405 nicely for if the user is doing something other than a PUT - some other descriptive errors might be a 400 if the date isn't in the right format, a 404 if the task with the given ID can't be found, or a 418 if the server is a teapot. Then if you catch an error and you still can't work out what it's about - it's time for a 500! I think the server will return a 500 for you if there's an uncaught error, so you still don't necessarily need to handle it yourselves.
The text was updated successfully, but these errors were encountered:
I noticed that in your API routes you're explicitly returning 500 errors - like here, for example
week-10-12-tfb-mark-gnnk/src/pages/api/update-status.js
Lines 19 to 22 in 1871333
A piece of advice that has stuck with me is never to return a 500 on purpose, or at the very least only to return a 500 if you really have no idea what to do with it, as it's for the case that "the server has encountered a situation it does not know how to handle".
You're already using 405 nicely for if the user is doing something other than a
PUT
- some other descriptive errors might be a400
if the date isn't in the right format, a404
if the task with the given ID can't be found, or a418
if the server is a teapot. Then if you catch an error and you still can't work out what it's about - it's time for a 500! I think the server will return a 500 for you if there's an uncaught error, so you still don't necessarily need to handle it yourselves.The text was updated successfully, but these errors were encountered: