This issue follows up on a discussion about core.async.interop 31/10/2019 on Clojurians #clojurescript channel where it was noted that questions about promises were a recurring topic.
David Nolen provided a macro and remarked that it could be a candidate for the core.async.interop namespace along with a post on the topic.
I put up https://github.com/filipesilva/async-interop with the macro, some tests, and what I imagine could be a guide in https://clojurescript.org/guides/ (except for this "Notes" section).
The guide page can be found at , and attached is a patch for core.async.
I don’t follow, isn’t the third argument to ex-info the cause? I’m sending err as the third argument and testing that the same instance is there in this test:
I don’t have an opinion about the name myself, happy to go with whatever people thing is best.
Regarding the macro, I think I’ll ping you on slack for clarification.
Here’s an update patch so that the throw logic is inside a function:
Right now the macro looks like this:
So the public names are throw-err, p->c , and <p!. I imagine the public names are chosen carefully so that the API can remain stable, so please let me know if you’d like them changed (e.g. to Thomas Heller’s unwrap-promise, wrap-promise, and await).
Released in core.async 1.1.582