-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add a final error handler package #310
Comments
Note: I don't think we should do this until Sentry has been removed from n-express fully, which will be a later major breaking version. Trying to move this code out right now will result in some unnecessary Sentry-related stuff being codified in Reliability Kit |
To add some firmer dates, we should be able to do this work after mid-August 2023. At this point we'll be fully removing Sentry from n-express |
This makes the error rendering middleware also take responsibility for outputting an error page in production environments. In production no error details are leaked and we only render the status code and message, this replicates the behaviour currently in n-express. We're doing this to reduce the footprint of n-express (#310) which currently contains some error rendering logic. Once use of the Reliability Kit error rendering middleware is more ubiquitous we should be able to remove the error handling code from n-express in a new major version. While this is technically a breaking change, if an app is using n-express then it's safe to upgrade. This is because this package behaves in exactly the same way as the n-express error handler.
This makes the error rendering middleware also take responsibility for outputting an error page in production environments. In production no error details are leaked and we only render the status code and message, this replicates the behaviour currently in n-express. We're doing this to reduce the footprint of n-express (#310) which currently contains some error rendering logic. Once use of the Reliability Kit error rendering middleware is more ubiquitous we should be able to remove the error handling code from n-express in a new major version. While this is technically a breaking change, if an app is using n-express then it's safe to upgrade. This is because this package behaves in exactly the same way as the n-express error handler.
This makes the error rendering middleware also take responsibility for outputting an error page in production environments. In production no error details are leaked and we only render the status code and message, this replicates the behaviour currently in n-express. We're doing this to reduce the footprint of n-express (#310) which currently contains some error rendering logic. Once use of the Reliability Kit error rendering middleware is more ubiquitous we should be able to remove the error handling code from n-express in a new major version. While this is technically a breaking change, if an app is using n-express then it's safe to upgrade. This is because this package behaves in exactly the same way as the n-express error handler.
This work is complete and made it into [email protected] |
Add a final error handling package which outputs the error status code, any headers that need to be set, and a basic text-based error page which is intended to be overridden by next-errors.
What problem does this feature solve?
We currently maintain code to output final error information within n-express. At time of writing, it looks like this:
This is a lot of code maintained outside of Reliability Kit with a focus on errors and how they get presented. We (the CP Reliability team) were the last people who made any changes to this code too.
It's difficult for us to own one part of one file within n-express, n-express does too much anyway, and this doesn't align with our ethos of "trust our engineers" – there's not an easy way to remove this error handling or configure it to suit your app, and it's hidden away in some n-express magic rather than being explicitly included.
Ideal solution
I think we should review what we need from this error rendering middleware and provide a new Reliability Kit package which does this instead. Unsure what it'd be called yet. It feels separate to #227 as we'd be moving existing functionality into Reliability Kit.
Alternatives
We could do nothing and keep this code in n-express, optionally trying to add us as owners of this file. I think we miss an opportunity to reduce the footprint and complexity of n-express though and hand some control back to our teams.
We could also release this package in Reliability Kit and import it into n-express in place of the custom code that'd currently maintained there.
The text was updated successfully, but these errors were encountered: