Permalink
Browse files

Nicer error messages for ExceptionInfo.

Note that this bumps the Clojure version to 1.4.

Also there might be some conditions where we want to re-throw, but I
don't have enough context to say what those would be.
  • Loading branch information...
1 parent cbda024 commit 193d4f0b61e67d7035b4ac3eea2d3ba4469d9d72 @technomancy committed Aug 8, 2012
Showing with 7 additions and 1 deletion.
  1. +1 −1 project.clj
  2. +6 −0 src/clj/reply/main.clj
View
@@ -2,7 +2,7 @@
(defproject reply "0.1.0-SNAPSHOT"
:description "REPL-y: A fitter, happier, more productive REPL for Clojure."
- :dependencies [[org.clojure/clojure "1.3.0"]
+ :dependencies [[org.clojure/clojure "1.4.0"]
[org.clojars.trptcolin/jline "2.8-SNAPSHOT"]
[org.thnetos/cd-client "0.3.4"]
[clj-stacktrace "0.2.4"]
View
@@ -36,6 +36,12 @@
clojure.repl/pst clj-stacktrace.repl/pst]
(reader.jline/setup-reader! ~options)
~@body)
+ (catch clojure.lang.ExceptionInfo e#
+ (let [status# (:status (:object (ex-data e#)))
+ body# (:body (:object (ex-data e#)))]
+ (cond (= 401 status#) (println "Unauthorized.")
+ (number? status#) (println "Remote error:" (slurp body#))
+ :else (clojure.repl/pst e#))))
(catch Exception e# (clojure.repl/pst e#))
(finally (exit/exit))))

0 comments on commit 193d4f0

Please sign in to comment.