Error handling for ASP.NET Core APIs — exception middleware, ProblemDetails,
94
90%
Does it follow best practices?
Impact
100%
1.13xAverage score across 5 eval scenarios
Passed
No known issues
IExceptionHandler and ProblemDetails RFC 7807
IExceptionHandler interface
100%
100%
AddExceptionHandler registration
100%
100%
AddProblemDetails registration
100%
100%
UseExceptionHandler called
100%
100%
TryHandleAsync returns true
100%
100%
ProblemDetails title field
50%
100%
ProblemDetails detail field
100%
100%
ProblemDetails instance field
0%
100%
Content-Type application/problem+json
100%
100%
No stack trace in 500 response
100%
100%
Typed exception status codes
12%
100%
OperationCanceledException and CancellationToken handling
OperationCanceledException caught separately
100%
100%
499 status code returned
100%
100%
Not logged at Error level
100%
100%
Logged at Information level
100%
100%
No exception details in 499 response body
100%
100%
CancellationToken in GET endpoint 1
100%
100%
CancellationToken in GET endpoint 2
100%
100%
CancellationToken passed to service calls
100%
100%
Generic exceptions still return 500
100%
100%
UseStatusCodePages for non-exception HTTP errors
UseStatusCodePages present
100%
100%
UseExceptionHandler present
100%
100%
Exception handler before routing
100%
100%
UseStatusCodePages before routing
100%
100%
pipeline_notes explains routing misses
100%
100%
pipeline_notes explains middleware ordering
100%
100%
AddProblemDetails registered
0%
100%
UseStatusCodePages with ProblemDetails format
100%
100%
InvalidModelStateResponseFactory and ValidationProblemDetails
InvalidModelStateResponseFactory configured
100%
100%
Returns ValidationProblemDetails
100%
100%
Title set to VALIDATION_ERROR
0%
100%
Status set to 400
100%
100%
Instance set to request path
0%
100%
Content-Type application/problem+json
100%
100%
At least four validation attributes
100%
100%
No manual validation in controller
100%
100%
validation_design.md mentions errors dictionary
100%
100%
Structured logging with ILogger message templates
No Console.WriteLine
100%
100%
No string interpolation in LogError
100%
100%
Named placeholders in log messages
100%
100%
Exception passed to logger
100%
100%
LogWarning for known API exceptions
100%
100%
LogError for unhandled exceptions
100%
100%
Request path included in log
100%
100%
Request method included in log
100%
100%
compliance_report identifies Console.WriteLine issue
100%
100%