Taking a look at the Problem Details enhancements in ASP.NET 9 #387
Replies: 1 comment
-
This is very interesting, but it does raise the discussion. When should exceptions be used. In C# they are more expensive than using a control flow for example. Is ItemNotFoundException a valid exception to be used? Or what about ValidationFailedException. Both are not really an exception, because it can happen that some request a non existing resource, as well as somebody trying to create a resource with invalid data. On the other side if more than 10% of your requests are ItemNotFoundExceptions, something else is probably wrong. What do you think about the use of the StatusCodeSelector in these cases? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Taking a look at the Problem Details enhancements in ASP.NET 9
How to make use of the new StatusCodeSelector property to change the default HTTP response status code (500) of a Problem Details response, based on the thrown exception.
https://timdeschryver.dev/blog/taking-a-look-at-the-problem-details-enhancements-in-aspnet-9
Beta Was this translation helpful? Give feedback.
All reactions