aspnetcore: Add extensible handlers to DeveloperExceptionPage

Add extensibility point to sub-systems to add handlers via DI that get inspected when an exception occurs. The handler can choose to render a response (e.g. the current EF diagnostic middleware page would change to this) or pass-through (do nothing). The middleware would fallback to rendering an HTML error page if no handler matched and the client sent an Accept header that included text/html, otherwise it would just return the error as plain text. For API responses, MVC would register a handler that formats a ProblemDetails with the relevant information according to the configured formatters.

There’s 2 work items here:

  • - Allowing components to take over the rendering of the error page depending on the exception type (like how EF has the database error page)
  • - Rendering a plaintext response if the client isn’t a browser (if the Accept header does not contain text/html)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 16 (15 by maintainers)

Most upvoted comments

FYI here are previous bugs tracking related (similar/same) stuff:

If the ‘very related’ bugs are entirely covered by this, should close those.