ASP.NET Core Exception Handling Tutorial | .NET 8

preview_player
Показать описание

Learn the new way to handle errors in .NET 8 APIs to avoid duplicating code and keep your app easy to maintain.

#csharp #dotnet #aspnetcore
Рекомендации по теме
Комментарии
Автор

Very nice! Thanks Julio! This kind of videos are awesome!

FB-ebtx
Автор

Hi @juli, could you please make a video to how we can save these logs into database or in third party logging system like loggly, or scaler ?

singhtech
Автор

I wonder regarding the validationException you had there,
I assume fluentValidation
Isnt it having some performance hit throwing a validation exception rather then just getting the validation result object and look at the IsValid property?

Its true that its more clean without the if statement, but is it more performant to enter a try catch statement for every place you have validation?

dorlugasigal
Автор

Great and detailed information. Thanks

bloopers
Автор

Hi Julio, thank you for this video especially for writing tuple i just found out in that way.

Anyway, how to get the request body? It can help us to identify or reproduce the error.

coding-in
Автор

@julio prior to dotnet 8, would we just add a middleware try/catch and handle it that way?

uu
Автор

What's the best way to handle exceptions in microservices architecture?

Can I create a shared project and reference the custom exception classes in each microservice?

Is there a better approach ?

Thanks

pt_trainer
Автор

Thanks for sharing. What happens if I have like 20 services?Does that means I will have to chain the AddProblemDetails() and the GlobalExpection extension on every service injection? How can I handle that?

sudidav
Автор

good tutorial, Is there any way to gracefully add exceptional status codes in this custom exceptional handler.As of now we are adding them manually, this may get cumbersome.Appreciate reading my comment!

AmazingTechnology-nw
Автор

Really useful stuff.Thanks!
btw is that code completion coming from copilot or some VS extension?

brijesh
Автор

I don't like the idea of mapping all errors of one type (unless you have one custom type specially for this) into an error message, especially when it's a stdlib exception. It feels like info could be leaked accidently and it should be done within the api endpoint handler explicitly. This also means the valid responses (I am also meaning the errors) are contained in one place and accessible to developers rather than hidden and magic.

Thanks for the video, was good.

GDWR
Автор

It's cool that the .NET team is formally supporting this commonly used pattern, but I don't like that it always catches _all_ exceptions, and the only way to handle specific types of exception is via reflection.

If I could specify an exception type as a generic type argument for the "UseExceptionHandler" method, something like "UseExceptionHandler<THandler, TException>()", that would be ideal. Maybe in .NET 9.

DisturbedNeo