summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Cohen <aaron@assonance.org>2010-05-19 20:41:20 -0400
committerStuart Halloway <stu@thinkrelevance.com>2010-05-19 20:43:39 -0400
commitea55e4c1169fc5cae36166bee80c41805e758872 (patch)
treeaba3ac19807d2bd274c11b281e97796c70a0a90f
parent3b07c0e98ebfd7025a5e36c7e47f6562e4750e14 (diff)
Do not allow the repl to crash if printing an object that throws an exception from its equals method
Signed-off-by: Stuart Halloway <stu@thinkrelevance.com>
-rw-r--r--src/clj/clojure/main.clj7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/clj/clojure/main.clj b/src/clj/clojure/main.clj
index 1af45bf8..e607440c 100644
--- a/src/clj/clojure/main.clj
+++ b/src/clj/clojure/main.clj
@@ -198,7 +198,12 @@
(prompt)
(flush)
(loop []
- (when-not (= (read-eval-print) request-exit)
+ (when-not
+ (try (= (read-eval-print) request-exit)
+ (catch Throwable e
+ (caught e)
+ (set! *e e)
+ nil))
(when (need-prompt)
(prompt)
(flush))