Interface to map exceptions to HTTP status codes. Implement this interface to create custom exception mapping logic.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
Interface declaration
Methods
GetStatusCode
Maps an exception to an appropriate HTTP status code.Parameters
The exception to evaluate.
Returns
The corresponding HTTP status code.
Implementations
Problemize provides a default implementation:- StatusCodeMapper - Maps common .NET exceptions to appropriate HTTP status codes
Example implementation
Usage
Register your custom mapper when configuring Problemize:Design considerations
- Return status codes from the
Microsoft.AspNetCore.Http.StatusCodesclass for consistency - Consider using specific 4xx codes for client errors and 5xx codes for server errors
- Provide a sensible default case (typically 500 Internal Server Error)
- Order exception types from most specific to least specific in switch expressions
- Document your custom mappings for API consumers