Coding Shorts: ASP.NET 8 - New Exception handling

preview_player
Показать описание
I am excite to have a more standard approach to global exception handling in .NET 8. But the legacy of the API does cause an issue. Let me show you how it works!

You can hire me too! You can reach me at my new website:

00:00 Introduction
01:12 Creating the Project
02:01 Throwing an Exception
03:25 Creating the Exception Handler
05:47 Testing the Handler
06:54 Working Around Empty Constructor
09:12 Watching Instead of Handling the Exception

If you like this video, you might like other videos in my Instructional Videos:
Рекомендации по теме
Комментарии
Автор

Thank you so much for your teaching great and simple presentation God bless you

lyudmilpetrov
Автор

Can't wait to upgrade. I have a need for this right now. 👏 Thank you, sir!

godfathermikal
Автор

Much more cleaner than creating your own middleware and try/catch the MoveNext call.

poteb
Автор

Great content Shawn, always joyful to see your content sir. Hope you will cover also new API Identity endpoint. Thanks and God bless :)

rockycaballero
Автор

Did not know about this. Thank you Shawn.

Rhysling
Автор

Thanks so much for this. I liked/subscribed and did all the things. You’re doing great work, man.

Phonophobic
Автор

Looks like a good step forward. I've always wanted the try/catch syntax to be stream-lined.
Maybe create a Base class (or decorator) that could handle process/handle most exceptions that would allow a lot of boilerplate exception handling to be moved to another area... idk.
thank you for the video.

larrye
Автор

.net aspire would be a good one from you shawn

nvshiem
Автор

Hi Shawn Nice video good example!

Video idea: I constantly see people overusing the dotnet mediator pattern, even for small monolithic apps. I'm not saying never use it, but only use it if you really need the decoupling.
The most common excuse for using it is for unit testing, or "it's best practice." I call BS. Besides, it's a PITA to debug badly written mediator components (for well-structured projects with good naming conventions, it can be less of a pain, though).
I'd like to hear your opinion on that.

DannyHille
Автор

This is an interesting pattern. One thing I missed is the scope of the exception handler - is it intended to handle every exception in your whole project, or just incoming http requests? For example would you have to use the httpcontext inside TryHandleAsync to limit its behavior to, say, just paths that start with /api (exposed endpoints)?

kdavis
Автор

Thanks that's was really helpful.

rankarat
Автор

Shawn, thanks for keeping us put to date is small practical and useful videos. I do not think any anyone has done a good treatment of object cloning, from the simple case to the shared reference case, so many ways to do it, reflection, code generation, Dehydrate - Hydrate, it could be a good series of videos

stevestrong
Автор

I think using the hellangs problem details middleware is more useful for real world exception handling especially when we have to handle specific exceptions.

JuanOG
Автор

Thank you for explaining this.
So I am assuming we can register multiple exception handlers and if that is the case will they follow any particular execution order like we see for middleware?

jawwadalam
Автор

this .http file is cool, I guess PostMan and Fidler do not think so but me as a developer... love it

vesnx
Автор

Hy Shawn, always like your content, appreciated! As for suggestions: what would be a smart way to implement authorization in Blazor based on the ClientId the user is in combined with his/her role for that client. I guess Policy based authorization with AuthorizationHandler and PolicyHandler would be the one to use (check role) but how to combine specifying checking role and ClientId together? Ideally one would do [Authorize(Roles = "Administrator", ClientId = _clientId)], but the last parameter is not possible (is my fantasy).

galberts
Автор

Any Repository related to this video? Thx

jorgepedraza
Автор

Great video. Would love to see you deploy an aspire on a self-hosted environment, such as a raspberry pie and windows server 2016

petropzqi
Автор

hi is there anyway i can use parameterized Mappers in dotnet core?

youshasajjad
Автор

what advice you would giive to a seasonal dotnet developer like me ? or a beginner T_T my mind is sooo overwhelmed with a lot of informations need to understand

bernpaul