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

A p/do in a p/catch of another p/do renders implicit exception handling ineffective #144

Open
DerGuteMoritz opened this issue Nov 9, 2023 · 0 comments

Comments

@DerGuteMoritz
Copy link

DerGuteMoritz commented Nov 9, 2023

Returning a promise constructed with p/do from a p/catch handler of another p/do promise renders the p/catch handler ineffective. Example:

(-> (p/do (throw :boom))
    (p/catch (fn [_] (p/do :ok)))
    (p/handle prn))

;; output:
nil :boom

While returning a resolved promise works fine:

(-> (p/do (throw :boom))
    (p/catch (fn [_] (p/resolved :ok)))
    (p/handle prn))

;; output:
:ok nil

And so does returning a rejected promise from the top-level p/do instead of throwing an exception:

(-> (p/do (p/rejected :boom))
    (p/catch (fn [_] (p/do :ok)))
    (p/handle prn))

;; output:
:ok nil

This relates to version 11.0.678. It still used to work as expected with version 8.0.450 (though I haven't tried any in between versions). Only tested with ClojureScript so far.

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

No branches or pull requests

1 participant