Skip to content

Commit 6cbcf4e

Browse files
committed
Make sure cider-open-classpath-entry doesn't blow up in the absence of a
connection or the classpath op
1 parent 83e15cb commit 6cbcf4e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

cider-classpath.el

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@
100100
(defun cider-open-classpath-entry ()
101101
"Open a classpath entry."
102102
(interactive)
103+
(cider-ensure-connected)
104+
(cider-ensure-op-supported "classpath")
103105
(when-let ((entry (completing-read "Classpath entries: " (cider-sync-request:classpath))))
104106
(find-file-other-window entry)))
105107

test/cider-classpath-tests.el

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,11 @@
1010
(ert-deftest cider-classpath-unsupported-op ()
1111
(noflet ((cider-ensure-op-supported (op) nil))
1212
(should-error (cider-classpath) :type 'user-error)))
13+
14+
(ert-deftest cider-open-classpath-entry-not-connected ()
15+
(noflet ((cider-connected-p () nil))
16+
(should-error (cider-open-classpath-entry) :type 'user-error)))
17+
18+
(ert-deftest cider-open-classpath-entry-unsupported-op ()
19+
(noflet ((cider-ensure-op-supported (op) nil))
20+
(should-error (cider-open-classpath-entry) :type 'user-error)))

0 commit comments

Comments
 (0)