From 4a6b25636a6e25d69db6e5575ab18f51bb0ff4e1 Mon Sep 17 00:00:00 2001 From: Stephen Brady Date: Sat, 28 May 2016 13:04:41 -0700 Subject: [PATCH] Return nothing for hinting if an exception occurs in trying to generate a hint --- .../src/lighttable/nrepl/auto_complete.clj | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lein-light-nrepl/src/lighttable/nrepl/auto_complete.clj b/lein-light-nrepl/src/lighttable/nrepl/auto_complete.clj index af7434a..d061618 100644 --- a/lein-light-nrepl/src/lighttable/nrepl/auto_complete.clj +++ b/lein-light-nrepl/src/lighttable/nrepl/auto_complete.clj @@ -73,11 +73,15 @@ (cljs-hints-for-ns (symbol ns-name) nss))) (defmethod core/handle "editor.clj.hints" [{:keys [session ns path] :as msg}] - (let [ns (eval/normalize-ns ns path)] - (core/respond msg "editor.clj.hints.result" (clj-hints ns) "json") + (let [ns (eval/normalize-ns ns path) + hints (try (clj-hints ns) + (catch Throwable t [""]))] + (core/respond msg "editor.clj.hints.result" hints "json") @session)) (defmethod core/handle "editor.cljs.hints" [{:keys [session ns path] :as msg}] - (let [ns (eval/normalize-ns ns path)] - (core/respond msg "editor.clj.hints.result" (cljs-hints ns) "json") + (let [ns (eval/normalize-ns ns path) + hints (try (cljs-hints ns) + (catch Throwable t [""]))] + (core/respond msg "editor.clj.hints.result" hints "json") @session))