ProblemDetails: support derived types in Map<TException>
See original GitHub issueIt’s not currently possible to create a map for an exception type and all its derived types.
options.Map<Exception>(e => /* only runs if typeof(e) is exactly Exception */);
This means that you can’t map an abstract exception class. You can map each individual derived exception type, but you can’t pre-configure maps for exception types that haven’t been invented yet.
Consider adding a flag to enable mapping derived types.
public void Map<TException>(Func<TException, MvcProblemDetails> mapping, bool includeDerived = false) where TException : Exception
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
ProblemDetails Class (Microsoft.AspNetCore.Mvc)
A short, human-readable summary of the problem type. It SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of...
Read more >Using the ProblemDetails Class in ASP.NET Core Web API
ProblemDetails class in ASP.NET Core Web APIs helps us to standardize our error handling and have better communication with API clients.
Read more >ValidationProblemDetails Class (Microsoft.AspNetCore.Mvc)
A human-readable explanation specific to this occurrence of the problem. (Inherited from ProblemDetails). Errors. Gets the validation errors associated with ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Pushed v2.0.0 😄
I appreciate it, I think this middleware does everything I need now (and saved me a bunch of time)