Skip to content

Conversation

ChaosCoder
Copy link
Contributor

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()
}

?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@ChaosCoder OK, I will fix this, thanks for the pull request.

@RomanPodymov RomanPodymov merged commit 55b527c into mxcl:master May 31, 2024
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