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
{
"context": "Tests whether the agent handles OperationCanceledException as a distinct, non-error case returning 499 status, logs it at Information level rather than Error, avoids returning exception details to the client, and ensures controller actions accept and propagate CancellationToken.",
"type": "weighted_checklist",
"checklist": [
{
"name": "OperationCanceledException caught separately",
"description": "ExceptionMiddleware has a distinct catch block (or condition) specifically for OperationCanceledException, separate from the generic Exception handler",
"max_score": 15
},
{
"name": "499 status code returned",
"description": "When an OperationCanceledException is caught, the HTTP response status code is set to 499 (not 200, not 500, not 204)",
"max_score": 15
},
{
"name": "Not logged at Error level",
"description": "The OperationCanceledException handler does NOT call _logger.LogError — the cancellation is not treated as a server error",
"max_score": 12
},
{
"name": "Logged at Information level",
"description": "The OperationCanceledException handler calls _logger.LogInformation (or LogDebug/LogTrace) to record the cancellation",
"max_score": 10
},
{
"name": "No exception details in 499 response body",
"description": "The cancelled-request response does NOT include ex.Message, ex.StackTrace, or any exception detail in the response body",
"max_score": 10
},
{
"name": "CancellationToken in GET endpoint 1",
"description": "The /api/queries/{id} controller action accepts a CancellationToken parameter",
"max_score": 10
},
{
"name": "CancellationToken in GET endpoint 2",
"description": "The /api/queries/search controller action accepts a CancellationToken parameter",
"max_score": 10
},
{
"name": "CancellationToken passed to service calls",
"description": "In at least one controller action, the CancellationToken is forwarded to the async service/repository call (not silently dropped)",
"max_score": 10
},
{
"name": "Generic exceptions still return 500",
"description": "The ExceptionMiddleware still has a catch block for generic Exception that returns HTTP 500 (cancellation handling did not replace the general error handler)",
"max_score": 8
}
]
}evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
skills
aspnet-error-handling
verifiers