Default implementation that maps known exceptions to appropriate HTTP status codes.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
Methods
GetStatusCode
Maps an exception to an appropriate HTTP status code.Parameters
The exception to evaluate.
Returns
The corresponding HTTP status code.
Exception mappings
The default mapper uses the following exception-to-status-code mappings:| Exception Type | HTTP Status Code | Code |
|---|---|---|
ArgumentNullException | 400 Bad Request | StatusCodes.Status400BadRequest |
ArgumentOutOfRangeException | 400 Bad Request | StatusCodes.Status400BadRequest |
InvalidOperationException | 400 Bad Request | StatusCodes.Status400BadRequest |
ValidationException | 400 Bad Request | StatusCodes.Status400BadRequest |
FormatException | 400 Bad Request | StatusCodes.Status400BadRequest |
OverflowException | 400 Bad Request | StatusCodes.Status400BadRequest |
NullReferenceException | 400 Bad Request | StatusCodes.Status400BadRequest |
UnauthorizedAccessException | 401 Unauthorized | StatusCodes.Status401Unauthorized |
KeyNotFoundException | 404 Not Found | StatusCodes.Status404NotFound |
FileNotFoundException | 404 Not Found | StatusCodes.Status404NotFound |
DirectoryNotFoundException | 404 Not Found | StatusCodes.Status404NotFound |
NotSupportedException | 405 Method Not Allowed | StatusCodes.Status405MethodNotAllowed |
TimeoutException | 408 Request Timeout | StatusCodes.Status408RequestTimeout |
OutOfMemoryException | 500 Internal Server Error | StatusCodes.Status500InternalServerError |
StackOverflowException | 500 Internal Server Error | StatusCodes.Status500InternalServerError |
NotImplementedException | 501 Not Implemented | StatusCodes.Status501NotImplemented |
| All other exceptions | 500 Internal Server Error | StatusCodes.Status500InternalServerError |
Example
Custom mapper
To override the default mappings, implement theIStatusCodeMapper interface: