Skip to content

Exclude cancellation from failure types and simplify failure helpers - #60

Merged
bisubus merged 32 commits into
masterfrom
fix-failure-typing
Oct 25, 2026
Merged

bisubus merged 32 commits into
masterfrom
fix-failure-typing

Conversation

@bisubus

@bisubus bisubus commented Oct 25, 2026

Copy link
Copy Markdown
Member

Cancellation no longer appears in declared failure types. A promise typed CancelablePromise<T, E> now reports only E, and the cancel reason stays a runtime concern, so a catch handler sees the declared failures and nothing else.

The failure helpers are simpler to call. withFailure takes several failure types and error matchers, and fail declares the failure it rejects with, so CancelablePromise.fail(error) and LazyPromise.fail(error) need no options argument. A rethrowing or translating catch keeps the failures it declared.

The open set of failures is explicit. Unlisted marks a failure set as open, and an already open set keeps one marker instead of listing it twice. Native promises read as Unlisted, and TOrUnlisted leaves a closed set closed.

Lazy promises strip cancellation from their failure carrier, so LazyPromise failures match CancelablePromise failures.

Breaking changes are listed in the changelog with migration notes for each affected package.

@bisubus
bisubus merged commit 66da8cb into master Oct 25, 2026
34 checks passed
@bisubus
bisubus deleted the fix-failure-typing branch October 25, 2026 23:09
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