-
Notifications
You must be signed in to change notification settings - Fork 9.9k
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add exception property to the problem details context #47651
Comments
Thank you for submitting this for API review. This will be reviewed by @dotnet/aspnet-api-review at the next meeting of the ASP.NET Core API Review group. Please ensure you take a look at the API review process documentation and ensure that:
|
Thanks! This will go through API review before implementation. @brunolins16 Do you have any insights that might guide the implementation/API review? |
API Review Notes:
API Approved! namespace Microsoft.AspNetCore.Http;
public sealed class ProblemDetailsContext
{
+ public Exception? Exception { get; init; }
} |
Sorry for late response.I like the idea and I am glad that the api is already approved. This will also useful for IProblemDetailsWrtier implementation. |
* add exception property to the problem details context fixes: #47651 * set exception in middlewares * add tests * Update src/Middleware/Diagnostics/src/DeveloperExceptionPage/DeveloperExceptionPageMiddlewareImpl.cs Co-authored-by: Chris Ross <Tratcher@Outlook.com> --------- Co-authored-by: Chris Ross <Tratcher@Outlook.com>
Background and Motivation
If an application is configured to generate problem details it would be good, if an exception occurs in the application, that the original exception can be retreived directly on the problem details context. The exception information can be used to customize the problem details when using the CustomizeProblemDetails functionality. The original exception can already be retreived using the IExceptionHandlerFeature, but having the exception directly on the context will be easier and more straight forward to use.
The exception property should be set when the problem details context is written from the built-in exception handler middlewares.
Proposed API
namespace Microsoft.AspNetCore.Http; public class ProblemDetailsContext { + public Exception? Exception { get; init; } }
Usage Examples
Alternative Designs
N/A
Risks
None that I am aware of.
The text was updated successfully, but these errors were encountered: