Return ProblemDetails from ASP.NET 8 IExceptionHandler global exception handler

IExceptionHandler allows us to globally handle exceptions in our ASP .NET 8 UI and API based apps.

Here’s an example we could use in an API context where we return a RFC 7807 (ProblemDetails) compliant response to the client.

What do you think?

Click on the image for a larger view in a new window …


Code -> Example of using .NET 8 IExceptionHandler to return 7807 ProblemDetails compliant response to client (github.com)

Leave a Reply

Your email address will not be published. Required fields are marked *