ASP.NET Core 8 - Exception handlers (goodbye error handling middlewares)

preview_player
Показать описание
Check out my web API .net8 full course: (over 14h of content!)
Let's connect on LI:

00:00 Intro
00:28 Middleware approach
01:55 Creating ExceptionHandler
05:20 DI registration
06:27 Bugged UseExceptionHandler middleware
07:16 Testing the ExceptionHandler
08:00 Multiple ExceptionHandlers
Рекомендации по теме
Комментарии
Автор

Check out my web API .net8 full course: (over 14h of content!)

AzureFullstackDev
Автор

So what if the exception is thrown in the middle of writing the response?
Will the response be cleared in favor of the exception response, or will they be merged?

theMagos
Автор

regarding the error at 6:38, you can add services.AddProblemDetails(); then you will not need to enter a stub in the form of a lambda and use this class to describe the error var problemDetail = new ProblemDetails {// class fields for the response code, etc. }
in the handler itself :) Great video overall, greetings from Azerbaijan

orhanaliyev
Автор

Thanks! one question from beginer: why do not you use here `ProblemDetails`? Is not it mandatory?

JohnSmith-yrih
Автор

Hey! Thanks for the explanation! I have the same error and you save me :D, very helpful!

FB-ebtx
Автор

I didn't understand what the advantages of this approach is over the middleware. Any explanation is appropriated.

codeme
Автор

How you're sending request from inside Visual studio?

bloopers
Автор

Please share your api github link pls
Btw great explanation 😊

ammarmasood