-
-
Notifications
You must be signed in to change notification settings - Fork 645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use a better error when a cljs repl form cannot be found #2307
Conversation
73eca6b
to
7a06850
Compare
Hmm, I'm not sure that suppressing the error is a good idea. Probably it should just be made more meaningful using |
Uhm True, will try a better fix |
cider.el
Outdated
@@ -755,7 +755,7 @@ 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 | |||
(when-let ((repl-form (cadr (seq-find |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you can just use if-let
here and show an user-error
in the else
branch. Something like No ClojureScript REPL type x found. Please check ...
7a06850
to
0152096
Compare
0152096
to
a72ad85
Compare
@bbatsov done 😄 |
54505a5
to
9b58752
Compare
cider.el
Outdated
(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`"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:D You should have replaced x with some interpolation of repl-type
. Same for cljs-repl-type
which is not een a param for this function. 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah got you! Let me google Elisp interpolations :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I thought Elisp had a construct for interpolations :D
9b58752
to
e567a78
Compare
cider.el
Outdated
(if (symbolp repl-form) | ||
(funcall repl-form) | ||
repl-form))) | ||
(if-let ((repl-form (cadr (seq-find |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this in the build log cider.el:756:30:Error:
(repl-form (cadr (seq-find (lambda (entry) (eq (car entry) repl-type)) cider-cljs-repl-types)))' is a malformed function. If think by mistake someone made
if-let` work with just one set of parens and the form was immediately deprecated afterwards in Emacs 26.1. See how we're using this elsewhere in the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh ok I actually did check the docstring for compatibility and it was saying both format are supported. Anyways will change.
cider.el
Outdated
(if (symbolp repl-form) | ||
(funcall repl-form) | ||
repl-form) | ||
(user-error (format "No ClojureScript REPL type %s found. Please make sure that `cider-cljs-repl-types` has an entry for it" repl-type)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think user-error
does format
implicitly inside. You can check the docstring.
e567a78
to
0c191f8
Compare
Without this fix cider throws an error but it is not a very clear one.
0c191f8
to
e258a60
Compare
👍 |
Without this fix cider throws an error but it is not a very clear one.
Before submitting the PR make sure the following things have been done (and denote this
by checking the relevant checkboxes):
The commits are consistent with our [contribution guidelines][1]
All tests are passing (
make test
)All code passes the linter (
make lint
) which is based onelisp-lint
and includesYou've updated the [changelog][3] (if adding/changing user-visible functionality)