diff options
author | Stuart Halloway <stu@thinkrelevance.com> | 2010-12-13 10:42:59 -0500 |
---|---|---|
committer | Stuart Halloway <stu@thinkrelevance.com> | 2010-12-17 10:25:19 -0500 |
commit | 7f303fc06b5e1d925a2fecef54b2597410c47111 (patch) | |
tree | f79906ffb27097978ae453735427dfce8934aca7 | |
parent | 7936c6f0a05e6c473c97c537e0b6acbfe43a73c2 (diff) |
do not count on stack traces being there at REPL reporting time #691
Signed-off-by: Stuart Halloway <stu@thinkrelevance.com>
-rw-r--r-- | src/clj/clojure/main.clj | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/clj/clojure/main.clj b/src/clj/clojure/main.clj index c21e20de..957a2b7d 100644 --- a/src/clj/clojure/main.clj +++ b/src/clj/clojure/main.clj @@ -104,12 +104,13 @@ "Default :caught hook for repl" [e] (let [ex (repl-exception e) - el (aget (.getStackTrace ex) 0)] + tr (.getStackTrace ex) + el (when-not (zero? (count tr)) (aget tr 0))] (binding [*out* *err*] (println (str (-> ex class .getSimpleName) " " (.getMessage ex) " " (when-not (instance? clojure.lang.Compiler$CompilerException ex) - (str " " (stack-element-str el)))))))) + (str " " (if el (stack-element-str el) "[trace missing]")))))))) (defn repl "Generic, reusable, read-eval-print loop. By default, reads from *in*, |