ProblemDetails: exception details always included regardless of configuration
See original GitHub issueHi,
ProblemDetails 6.2.0
In startup.cs I have defined:
services.AddProblemDetails(options => {
options.IncludeExceptionDetails = (ctx, ex) => false; //disabled completely for verifying the bug
options.MapToStatusCode<NotImplementedException>(StatusCodes.Status501NotImplemented);
options.MapToStatusCode<HttpRequestException>(StatusCodes.Status503ServiceUnavailable);
options.MapToStatusCode<Exception>(StatusCodes.Status500InternalServerError);
})
.AddControllers()
.AddProblemDetailsConventions()
.AddJsonOptions(x => x.JsonSerializerOptions.IgnoreNullValues = true);
But even with the exception details disabled completely, the inner exception and stack trace are included in the response when performing e.g. a 400 Bad Request .
I can’t seem to find any other conflicting configuration for this in my code.
Any ideas?
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
How to use the ProblemDetails middleware in ASP.NET Core
The following configuration will make sure that exception details are included only if you're in the development environment. public void ...
Read more >Handling Web API Exceptions with ProblemDetails ...
The default configuration converts non-exception responses to ProblemDetails when the following is true: The status code is between 400 and 600 ...
Read more >Using the ProblemDetails Class in ASP.NET Core Web API
Configuring Exception Details. Firstly, we should always customize the middleware to include the exception details only in the development ...
Read more >Format response data in ASP.NET Core Web API
Learn how to format response data in ASP.NET Core Web API.
Read more >Exception Handling in Spring MVC
The most common way to set a default error page has always been the SimpleMappingExceptionResolver (since Spring V1 in fact). We will discuss ......
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
Lovely. Another reason to stay away from OData 😅
D’oh, of course. Now to figure out why the 400 is not mapped correctly with this configuration… Thanks for the assist!