Skip to content

Commit

Permalink
Use a better error when a cljs repl form cannot be found
Browse files Browse the repository at this point in the history
Without this fix cider throws an error but it is not a very clear one.
  • Loading branch information
arichiardi committed Jun 5, 2018
1 parent 89cb4a4 commit a72ad85
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
### Bugs fixed

* [#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): Handle nil when the cljs repl form cannot be found.

## 0.17.0 (2018-05-07)

Expand Down
17 changes: 9 additions & 8 deletions cider.el
Original file line number Diff line number Diff line change
Expand Up @@ -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 x found. Please make sure that `cider-cljs-repl-types` has an entry for `cljs-repl-type`")))

(defun cider-verify-cljs-repl-requirements (repl-type)
"Verify that the requirements for REPL-TYPE are met."
Expand Down

0 comments on commit a72ad85

Please sign in to comment.