Skip to content

fix(api): treat client request-aborts as 499, not a logged 500 - #141

Merged
ma7moudalysalem merged 1 commit into
mainfrom
fix/request-abort-not-500
Jul 7, 2026
Merged

ma7moudalysalem merged 1 commit into
mainfrom
fix/request-abort-not-500

Conversation

@ma7moudalysalem

Copy link
Copy Markdown
Owner

A cancelled HTTP request (client disconnects / React Query aborts an in-flight query) makes ASP.NET's RequestAborted token fire and the EF query throw OperationCanceledException — which fell into the catch-all, logged as 'Unhandled exception' + answered 500 to a dead socket. Catch it explicitly (guarded on RequestAborted.IsCancellationRequested) → return 499, no error log. Expected behaviour, not a bug.

A cancelled HTTP request (the client disconnects, or React Query aborts an
in-flight query on unmount/refetch) makes ASP.NET's RequestAborted token fire and
the in-flight EF query throw OperationCanceledException. It was falling into the
catch-all — logged as "Unhandled exception" and answered with a 500 to a socket
that's already gone. Catch it explicitly (guarded on RequestAborted) and return
499 without the error log. Expected behaviour, not an error.
Copilot AI review requested due to automatic review settings July 7, 2026 12:53
@ma7moudalysalem
ma7moudalysalem merged commit e8a7f9b into main Jul 7, 2026
@ma7moudalysalem
ma7moudalysalem deleted the fix/request-abort-not-500 branch July 7, 2026 12:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants