Closed
Description
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)