dotnet / dotnet/AspNetCore.Docs

Suggestion: Include a simple example of how to set up ProblemDetails to include/exclude the exception details.

Open
#29,718 0 comments 0 reactions 1 assignee Claimed by @tdykstra View on GitHub
doc-idea Source - Docs.ms
Dominant language
C#
Stars
13.1k
Forks
24.6k
Avg merge
1d 3h
Merged PRs (30d)
97

Description

👋🏻 G'day - would be really helpful/nice to include some sample code to include/exclude any exception information if the environment is _not_ `IsDevelopment()`.

if it `IsDevelopment()` then we can see the extra _exception_ information. This is different to error information for 400 bad requests, etc. which I would have thought, should always be shown/displayed.

---
#### Document Details

⚠ *Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.*

* ID: 3f6504cd-a059-c5d4-73fb-61222ef1c6e0
* Version Independent ID: 1b42352c-a34f-7703-aa3e-d7e3156bd0bd
* Content: [Handle errors in ASP.NET Core web APIs](https://learn.microsoft.com/en-us/aspnet/core/web-api/handle-errors?view=aspnetcore-7.0)
* Content Source: [aspnetcore/web-api/handle-errors.md](https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/web-api/handle-errors.md)
* Product: **aspnet-core**
* Technology: **aspnetcore-webapi**
* GitHub Login: @tdykstra
* Microsoft Alias: **riande**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.