CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/aspnet-error-handling

Error handling for ASP.NET Core APIs — exception middleware, ProblemDetails,

94

1.13x
Quality

90%

Does it follow best practices?

Impact

100%

1.13x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

Evaluation results

100%

21%

Travel Booking API — Error Handling Setup

IExceptionHandler and ProblemDetails RFC 7807

Criteria
Without context
With context

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%

100%

Analytics Query API — Request Cancellation Handling

OperationCanceledException and CancellationToken handling

Criteria
Without context
With context

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%

100%

15%

Logistics API Gateway — Consistent Errors for All HTTP Status Codes

UseStatusCodePages for non-exception HTTP errors

Criteria
Without context
With context

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%

100%

22%

Patient Registration API — Validation Error Standardisation

InvalidModelStateResponseFactory and ValidationProblemDetails

Criteria
Without context
With context

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%

100%

Insurance Claims API — Logging Overhaul for Compliance Audit

Structured logging with ILogger message templates

Criteria
Without context
With context

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%

Evaluated
Agent
Claude Code
Model
Claude Sonnet 4.6

Table of Contents