aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscgilardi <scgilardi@gmail.com>2009-06-06 14:24:26 +0000
committerscgilardi <scgilardi@gmail.com>2009-06-06 14:24:26 +0000
commit83fa7099432d5af2febbad9c33e076b9a03c3d1e (patch)
treec3be3569681e295f99f18a8d59702e0c464ff9d7
parent47fefa28e235e5fcd0377e1bd930eb05a6a9d23b (diff)
except: support exception classes that don't allow wrapping a cause
-rw-r--r--src/clojure/contrib/except.clj5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/clojure/contrib/except.clj b/src/clojure/contrib/except.clj
index 8cb98417..93153342 100644
--- a/src/clojure/contrib/except.clj
+++ b/src/clojure/contrib/except.clj
@@ -81,7 +81,10 @@ formatted using clojure.core/format."}
[arg] args
[cause & args] (if (throwable? arg) args (cons nil args))
message (when args (apply format args))
- ctor-args (into-array Object [message cause])
+ ctor-args (into-array Object
+ (cond (and message cause) [message cause]
+ message [message]
+ cause [cause]))
throwable (Reflector/invokeConstructor class ctor-args)
our-prefix "clojure.contrib.except$throwable"
not-us? #(not (.startsWith (.getClassName %) our-prefix))