Bald Bearded Builder
aspnetcore/iexceptionhandler-makes-asp-net-exceptions-easy

IExceptionHandler Makes ASP.NET Exceptions Easy

.NET 8's `IExceptionHandler` supports centralized ASP.NET exception handling through built-in middleware and modular handlers for specific exception types.

Loads from YouTube when you press play

Transcript 1 topic

IExceptionHandler in .NET 8

0:00

If you're using dot net eight or above to build ASP dot net applications, you really should be using the IExceptionHandler interface to catch exceptions globally. I don't have time in this short to go through all the details of building that, but I have left a link in the little cards over there where you can go check out a more expansive approach to building global exception handling in your asp.net apps. But why would you use it? Well, one, it uses the built in use exception handler middleware that dot net has included with it. It's what many of the extension methods you use, like authorization, authentication.

They all use that same exception handler. So you're just using what's baked in, which means you don't need to build custom middleware. It also makes it really easy to set up and define specific handlers for specific exceptions or specific types of exceptions within our application. But being able to include those and use them independently can help our code be more modular and a lot more maintainable.

Sign in to join in. Reading needs nothing.