summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Richiardi <a.richiardi.work@gmail.com>2018-06-04 17:05:49 -0700
committerBozhidar Batsov <bozhidar.batsov@gmail.com>2018-06-07 08:08:27 +0900
commit49034dc2b416ba80019d2cedcff65d9bd1224972 (patch)
treea455fa08ca128b0faabb9a55bf3b52a619fc7ac3
parent82b8165e984db9e55f9d822a4d3278dad9860e4c (diff)
Use a better error when a cljs repl form cannot be found
Without this fix cider throws an error but it is not a very clear one.
-rw-r--r--CHANGELOG.md1
-rw-r--r--cider.el17
2 files changed, 10 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 63f04a3a..bcc9b156 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@
* [#2294](https://github.com/clojure-emacs/cider/issues/2294): Fix setting default stacktrace filters.
* [#2286](https://github.com/clojure-emacs/cider/issues/2286): Fix eldoc issue with images in the REPL.
+* [#2307](https://github.com/clojure-emacs/cider/pull/2307): Use a better error when a cljs repl form cannot be found.
## 0.17.0 (2018-05-07)
diff --git a/cider.el b/cider.el
index 0a3d4672..2dc80154 100644
--- a/cider.el
+++ b/cider.el
@@ -755,14 +755,15 @@ you're working on."
(defun cider-cljs-repl-form (repl-type)
"Get the cljs REPL form for REPL-TYPE."
- (let ((repl-form (cadr (seq-find
- (lambda (entry)
- (eq (car entry) repl-type))
- cider-cljs-repl-types))))
- ;; repl-form can be either a string or a function producing a string
- (if (symbolp repl-form)
- (funcall repl-form)
- repl-form)))
+ (if-let* ((repl-form (cadr (seq-find
+ (lambda (entry)
+ (eq (car entry) repl-type))
+ cider-cljs-repl-types))))
+ ;; repl-form can be either a string or a function producing a string
+ (if (symbolp repl-form)
+ (funcall repl-form)
+ repl-form)
+ (user-error "No ClojureScript REPL type %s found. Please make sure that `cider-cljs-repl-types' has an entry for it" repl-type)))
(defun cider-verify-cljs-repl-requirements (repl-type)
"Verify that the requirements for REPL-TYPE are met."