From 7bd8153b095f5c768d54e6840cb340c65e0ccea5 Mon Sep 17 00:00:00 2001 From: Isaac Cambron Date: Sun, 2 Aug 2015 16:11:19 -0400 Subject: [PATCH] Print a better error when failing to load middleware --- src/cemerick/piggieback.clj | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/cemerick/piggieback.clj b/src/cemerick/piggieback.clj index 474277d..5105318 100644 --- a/src/cemerick/piggieback.clj +++ b/src/cemerick/piggieback.clj @@ -217,7 +217,11 @@ ; environment after each eval (try (let [repl-env (delegating-repl-env repl-env nil)] - (set! ana/*cljs-ns* 'cljs.user) + (try + (set! ana/*cljs-ns* 'cljs.user) + (catch IllegalStateException e + (println "Can't set root bindings. This is likely caused by the nrepl middleware failing to load. You may have misconfigured it, or it could be a result of running in an unsupported environment (specifically `lein trampoline repl` generally doesn't work right; run without trampoline). Exact exception below.") + (throw e))) ; this will implicitly set! *cljs-compiler-env* (run-cljs-repl (assoc ieval/*msg* ::first-cljs-repl true) (nrepl/code (ns cljs.user @@ -232,7 +236,10 @@ (set! *ns* (find-ns ana/*cljs-ns*)) (println "To quit, type:" :cljs/quit)) (catch Exception e - (set! *cljs-repl-env* nil) + (try + (set! *cljs-repl-env* nil) + ;;bury so we get the real exception + (catch Exception _)) (throw e)))) ;; mostly a copy/paste from interruptible-eval