Skip to content
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

Provide a JSON view of the error info page #227

Open
rowanmanning opened this issue Oct 11, 2022 · 0 comments
Open

Provide a JSON view of the error info page #227

rowanmanning opened this issue Oct 11, 2022 · 0 comments
Labels
enhancement New feature or request package: middleware-render-error-info Relates to the middleware-render-error-info package requested Used to indicate that a team outside of the maintainers of this repo has requested this work

Comments

@rowanmanning
Copy link
Member

rowanmanning commented Oct 11, 2022

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

CPREL-322

@rowanmanning rowanmanning added enhancement New feature or request package: middleware-render-error-info Relates to the middleware-render-error-info package labels Oct 11, 2022
@rowanmanning rowanmanning moved this to 📥 Inbox in Reliability Kit Roadmap Oct 11, 2022
@rowanmanning rowanmanning added the requested Used to indicate that a team outside of the maintainers of this repo has requested this work label Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request package: middleware-render-error-info Relates to the middleware-render-error-info package requested Used to indicate that a team outside of the maintainers of this repo has requested this work
Projects
Status: 📥 Inbox
Development

No branches or pull requests

1 participant