Skip to content

Commit

Permalink
Support (try (catch :default)) in CLJS exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
travis authored and dnolen committed Oct 15, 2014
1 parent 47ad737 commit bd71ba7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/clojure/cljs/core/async/impl/ioc_helpers.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@

(and exception
catch-block
(instance? catch-exception exception))
(or (= :default catch-exception)
(instance? catch-exception exception)))
(ioc/aset-all! state
STATE-IDX
catch-block
Expand Down
6 changes: 6 additions & 0 deletions src/test/cljs/cljs/core/async/runner_tests.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@
(assert false)
(catch js/Error ex 42))))

(is= 42
(runner
(try
(assert false)
(catch :default ex 42))))

(let [a (atom false)
v (runner
(try
Expand Down

0 comments on commit bd71ba7

Please sign in to comment.