ASP.NET Core 8 new feature: IExceptionHandler

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

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

this middleware will work when any controller not handling the exception or is it handling the exception thrown by the controller ?

nicki
Автор

How to glibal handle exceptions with result pattern?

hamzaidrees
Автор

Handling exceptions in middelware is bad. What if content type is diffrent than json?
IExceptionFilter is valid solution and It is there from some time. You can write Result there (without messing with serialization).

Also sec common mistake. Before writing to reposnse in middleware flag (i don't remeber the name but It is mentioned in documntation about middlewares) should be checked if response procedure had not been alredy started.

psdmaniac
Автор

Is this good for cqrs with MediatR pattern? If yes, what advantages did this have for api return objects for front end?

Paul-uosv
Автор

It would be nice if we dont need to register customer middlware, but re just add the middleware and it registers and we dont need to worry about ordering...

kennyhendricks
Автор

Why do we always need to do an Add... and then Use...?
It's it enough to add the middleware?
Why add a middleware you don't want to use?

makemeafirewall
Автор

The former implementation was simpler to implement than this one.

If there's no performance benefits then I prefer the former approach

bloggrammer