question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ProblemDetails: support derived types in Map<TException>

See original GitHub issue

It’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:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
khellangcommented, Oct 8, 2018

Pushed v2.0.0 😄

0reactions
sliekenscommented, Oct 9, 2018

I appreciate it, I think this middleware does everything I need now (and saved me a bunch of time)

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found