Global Exception Handling in ASP.NET Core Web API

A good web API is consistent and follows established patterns for communicating error states to the client, leveraging the appropriate HTTP status codes. To that end, a global exception handler can be very helpful in consolidating a service’s error handling logic in one place and translating errors into the appropriate responses to send back to the caller. In this post I’ll show you how you can plug your custom exception-handling logic into the ASP.NET Core request pipeline to handle any exceptions that are thrown in your service.
April 20, 2020
686
559