Exception handler that converts exceptions into standardized problem details responses following RFC 9457.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/FloppyShelf/Problemize/llms.txt
Use this file to discover all available pages before exploring further.
Namespace
Class declaration
Constructor
Creates a new instance of theExceptionHandler class.
Parameters
The service used to write problem details responses.
The component responsible for mapping exceptions to HTTP status codes.
Methods
TryHandleAsync
Attempts to handle the exception and generate a problem details response.Parameters
The current HTTP context.
The exception to handle.
Cancellation token for async operations.
Returns
Returns
true if the exception was handled and a response was written; otherwise, false.Behavior
This method:- Sets the HTTP response status code based on the exception using the status code mapper
- Creates a
ValidationProblemDetailsforValidationExceptioninstances - Creates a standard
ProblemDetailsfor all other exceptions - Writes the problem details response using the problem details service
Problem details structure
For validation exceptions:- Title: “An error occured while validating your request”
- Detail: The exception message
- Type: The exception type name
- Title: “An error occured while processing your request”
- Detail: The exception message
- Type: The exception type name