Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Handle init-ns compile errors more gracefully

refs #106
  • Loading branch information...
1 parent 92a3dce commit a8ca026fb7d1c1ef427717afcc80b59777a90c44 @trptcolin committed
Showing with 13 additions and 1 deletion.
  1. +13 −1 src/clj/reply/eval_modes/nrepl.clj
14 src/clj/reply/eval_modes/nrepl.clj
@@ -127,12 +127,24 @@
(list "")))))
(list request-exit)))
+(defn- handle-ns-init-error [ns connection options]
+ (if (= ns "reply.eval-modes.nrepl")
+ (let [fallback-ns
+ (execute-with-client
+ connection options
+ "(in-ns 'user)
+ (println \"\\nError loading namespace; falling back to user\")")]
+ (println)
+ fallback-ns)
+ ns))
(defn run-repl
([connection] (run-repl connection nil))
([connection {:keys [prompt] :as options}]
(let [{:keys [major minor incremental qualifier]} *clojure-version*]
(loop [ns (execute-with-client connection options "")]
- (let [eof (Object.)
+ (let [ns (handle-ns-init-error ns connection options)
+ eof (Object.)
execute (partial execute-with-client connection
(assoc options :interactive true))
forms (parsed-forms {:request-exit eof

0 comments on commit a8ca026

Please sign in to comment.
Something went wrong with that request. Please try again.