Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Single global error method #8
The beginnings of this already exist in src/Util/handleError.js but currently this only handles logging the error to the database.
It would be great if this also handled sending the correct response to the web request so that we can reduce code duplication on all routes that catch errors.
This needs to consider that website routes will want an HTML 500 response but for all API routes, they will expect a JSON response.
Example website usage: src/Routes/Lists.js#L44-L45
Code duplication is a pain and we want to ensure all errors across the site return a consistent response (API should have a consistent JSON response too).