Skip to content

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

@DerGuteMoritz

Description

@DerGuteMoritz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions