-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Currently the error info page is only viewable as HTML. We should consider adding a JSON-based view.
What problem does this feature solve?
For JSON-based APIs, an HTML error page doesn't make a lot of sense, especially when most local development is done using curl
or Postman. In these cases it's actually unhelpful to have an HTML-based error page.
Ideal solution
We allow for apps to configure the error info page to output the data as JSON instead of HTML. Something like this:
const renderErrorInfoPage = require('@dotcom-reliability-kit/middleware-render-error-info');
app.use(renderErrorInfoPage({
renderer: 'json' // defaults to 'html'
}));
Alternatives
-
We could do nothing. Maybe this isn't actually a use-case we need to consider? If an app is JSON-based then it's likely (it should be) already handling errors and responding with a JSON representation.
-
Instead of complicating the error debug page, maybe we provide a separate production-ready JSON-based error handler which. This would require us deciding on a single standard for JSON-based errors which works for all our apps.
See also
Metadata
Metadata
Assignees
Labels
Type
Projects
Status