Closed martinklepsch closed 8 years ago
Hey, @martinklepsch. I think I can shed some light on this:
d/chain
is creating a second deferred with a value derived from dd
, but you're not retaining that new deferred in any way (and not forcing it to be delivered).
Compare with the following version:
(let [dd (d/deferred)
dd2 (-> dd
(d/chain #(do (assert (string? %) "invalid") %) prn)
(d/catch #(str "something unexpected:" (.getMessage %))))]
(d/success! dd nil)
[@dd @dd2])
;; => [nil "something unexpected:Assert failed: invalid\n(string? p1__81197#)"]
Hope that helps.
@camdez oh — you're totally right. I expected something to be printed but str
just makes a different return value which I'm not explicitly checking! Thanks!
Executing the above I expect one of the two outcomes:
prn
is called with the string value put onto the deferredcatch
handler prints some exceptionWhat happens instead is that
true
is returned,prn
is not being called, no exception is printed.I tried looking into the
catch
/catch'
code but nothing stood out andAssertionError
is extendingThrowable
so not sure what's going on there.