Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resume continuation on cancellation when using .async() #1334

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ChaosCoder
Copy link

When using .async() with a cancelled promise, the continuation was never completed, because the error was ignored (default catch policy ignores cancellation). This fixes it.

I also already bumped the version to 8.1.2 to make it less work ;)

@RomanPodymov RomanPodymov self-requested a review February 21, 2024 09:56
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)
func testAsyncPromiseCancel() async throws {
do {
let p = after(seconds: 0).done { _ in
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not

let p = after(seconds: 0).then { _ in
    throw LocalError.cancel
}.done {
    XCTFail()
}.catch { _ in
    XCTFail()
}

?

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.

None yet

2 participants