Welcome! Please see the About page for a little more info on how this works.

0 votes
in core.async by

The following will cause the failed assertion (ioc_helpers.cljs:155)
when evaluated as a whole, and will correctly catch the Error when
just the try' gets evaluated. The finally' block runs only if the
inner block is evaluated:

`
(go
(try

(throw (js/Error. "asdf"))
(catch ExceptionInfo e
  (println "ExceptionInfo"))
(catch js/Error e
  (println "js/Error"))
(finally
  (println "finally"))))

`

Another notable observation is that changing the order of the `catch'
blocks will change the behavior: If the (catch js/Error ...) is the
first catch block, it will work just as expected.

3 Answers

0 votes
by

Comment made by: hiredman

this appears to be very similar to http://dev.clojure.org/jira/browse/ASYNC-169, async-169 is on the clojure side of the library, but it looks like both sides have similar problematic exception handling logic

0 votes
by

Comment made by: jmlsf

Similar issue, but without a finally block:

`
(defn test-go-exception
[]
(go

(try
  (throw (new js/TypeError "unexpected"))
  (catch ExceptionInfo e
    (js/console.log "test-go-exception: ExceptionInfo catch"))
  (catch :default e
    (print "test-go-exception: default catch")))))

(test-go-exception)
;; Throws an exception "ioc_helpers.cljs:146 Uncaught Error: No matching clause"
`

0 votes
by
Reference: https://clojure.atlassian.net/browse/ASYNC-73 (reported by the-kenny)
...