Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix bugs in the reraise part of the try macro in core

Signed-off-by: Jordan Wilberding <diginux@gmail.com>
  • Loading branch information...
commit d7b2a0094f14562ee9423d15122be47d563fec0f 1 parent 38536db
@ericbmerritt ericbmerritt authored jwilberding committed
Showing with 17 additions and 14 deletions.
  1. +17 −14 src/joxa/core.jxa
View
31 src/joxa/core.jxa
@@ -110,19 +110,22 @@
;; him. This looks for a catch-all in the correct format. At the
;; moment it is not complete, but those can be added as we move
;; forward through time.
-(defn needs-last-try? (clauses)
- (case clauses
- ([({:_ :_} . _)]
- :false)
- ([(:_ . _)]
- :false)
- ([({i1 i2} . _)] (when (erlang/and (erlang/is_atom i1)
- (erlang/is_atom i2)))
- :false)
- ([(i1 . _)] (when (erlang/is_atom i1))
- :false)
- (_
- :true)))
+(defn needs-reraise? (clauses)
+ (lists/all (fn (clause)
+ (case clause
+ (({:_ :_} . _)
+ :false)
+ ((:_ . _)
+ :false)
+ (({i1 i2} . _)
+ (when (erlang/and (erlang/is_atom i1)
+ (erlang/is_atom i2)))
+ :false)
+ ((i1 . _) (when (erlang/is_atom i1))
+ :false)
+ (_
+ :true)))
+ clauses))
(defmacro+ try (&rest body)
(let (type (gensym)
@@ -134,7 +137,7 @@
~@exprs)
(catch (~type ~err)
(case {~type ~err}
- ~@(if (needs-last-try? clauses)
+ ~@(if (needs-reraise? clauses)
(lists/append clauses
[`(_
(erlang/raise ~type ~err (erlang/get_stacktrace)))])
Please sign in to comment.
Something went wrong with that request. Please try again.