Ghost/ghost/mw-error-handler/test
Chris Raible 9a8c703e34
Improved error handling for SQL errors (#18797)
refs TryGhost/Product#4083

- In the vast majority of cases, we shouldn't have SQL errors in our
code. Due to some limitations with validating e.g. nql filters passed to
the API, sometimes we don't catch these errors and they bubble up to the
user.
- In these rare cases, Ghost was returning the raw SQL error from mysql
which is not very user friendly and also exposes information about the
database, which generally is not a good practice.
- To make things worse, Sentry was treating every instance of these
errors as a unique issue, even when it was exactly the same query
failing over and over.
- This change improves the error message returned from the API, and also
makes sure that Sentry will group all these errors together, so we can
easily see how many times they are happening and where.
- It also adds more specific context to the event that is sent to
Sentry, including the mysql error number, code, and the SQL query
itself.
2023-11-01 13:47:41 -07:00
..
utils Add @tryghost/mw-error-handler 2021-12-07 18:40:46 +00:00
.eslintrc.js Add @tryghost/mw-error-handler 2021-12-07 18:40:46 +00:00
mw-error-handler.test.js Improved error handling for SQL errors (#18797) 2023-11-01 13:47:41 -07:00