core.async

(CLJS) try-catch-finally broken inside go-blocks

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Critical Critical
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Environment:
    clojure 1.6.0, clojurescript 0.0-2234, core.async 0.1.303.0-886421-alpha1

Description

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.

Activity

Hide
Kevin Downey added a comment -

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

Show
Kevin Downey added a comment - 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
Hide
Justin Lee added a comment - - edited

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"
Show
Justin Lee added a comment - - edited 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"

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated: