Skip to content

feat(errors): add ErrClientCancelled sentinel for client-side cancellation detection#209

Draft
yushan8 wants to merge 1 commit into
mainfrom
yushan/client-cancellation-sentinel
Draft

feat(errors): add ErrClientCancelled sentinel for client-side cancellation detection#209
yushan8 wants to merge 1 commit into
mainfrom
yushan/client-cancellation-sentinel

Conversation

@yushan8

@yushan8 yushan8 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds ErrClientCancelled sentinel to core/errors for use with context.WithCancelCause
  • Adds IsClientCancellation(ctx) helper to check if a context was cancelled by a client disconnect
  • Enables distinguishing client-initiated cancellations from server-side or timeout cancellations

Test plan

  • Unit tests for IsClientCancellation covering: cause set, no cause, different cause, uncancelled context, wrapped cause

…n helper

Allows callers to distinguish client-initiated cancellations from
server-side or timeout cancellations using context.WithCancelCause.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@yushan8 yushan8 closed this Jul 17, 2026
@yushan8 yushan8 reopened this Jul 21, 2026
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.

1 participant