Skip to content

Commit cf625a1

Browse files
committed
Merge pull request #1200 from Malabarba/master
Improve some error-handling
2 parents b4573a8 + 32fe4c3 commit cf625a1

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

cider-debug.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ needed. It is expected to contain at least \"key\", \"input-type\", and
467467
\"prompt\", and possibly other entries depending on the input-type."
468468
(nrepl-dbind-response response (debug-value key coor code file point ns original-id
469469
input-type prompt inspect)
470-
(condition-case nil
470+
(condition-case-unless-debug e
471471
(progn
472472
(pcase input-type
473473
("expression" (cider-debug-mode-send-reply (cider-read-from-minibuffer
@@ -494,7 +494,7 @@ needed. It is expected to contain at least \"key\", \"input-type\", and
494494
(cider-inspector--done-handler (current-buffer))))
495495
;; If something goes wrong, we send a "quit" or the session hangs.
496496
(error (cider-debug-mode-send-reply ":quit" key)
497-
(cider-popup-buffer-quit-function (not (buffer-modified-p)))))))
497+
(message "Error encountered while handling the debug message: %S" e)))))
498498

499499

500500
;;; User commands

cider-interaction.el

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -943,15 +943,15 @@ Display the results in a different window."
943943
(progn
944944
(if line (setq info (nrepl-dict-put info "line" line)))
945945
(cider--jump-to-loc-from-info info t))
946-
(error "Symbol %s not resolved" var)))
946+
(user-error "Symbol %s not resolved" var)))
947947

948948
(defun cider--find-var (var &optional line)
949949
"Find the definition of VAR, optionally at a specific LINE."
950950
(-if-let (info (cider-var-info var))
951951
(progn
952952
(if line (setq info (nrepl-dict-put info "line" line)))
953953
(cider--jump-to-loc-from-info info))
954-
(error "Symbol %s not resolved" var)))
954+
(user-error "Symbol %s not resolved" var)))
955955

956956
(defun cider-find-var (&optional arg var line)
957957
"Find definition for VAR at LINE.
@@ -981,7 +981,7 @@ thing at point."
981981
(defun cider--find-ns (ns &optional other-window)
982982
(-if-let (path (cider-sync-request:ns-path ns))
983983
(cider-jump-to (cider-find-file path) nil other-window)
984-
(error "Can't find %s" ns)))
984+
(user-error "Can't find %s" ns)))
985985

986986
(defun cider-find-ns (&optional arg ns)
987987
"Find the file containing NS.
@@ -1134,7 +1134,7 @@ in the buffer."
11341134
(url (nrepl-dict-get info "javadoc")))
11351135
(if url
11361136
(browse-url url)
1137-
(error "No Javadoc available for %s" symbol-name)))))
1137+
(user-error "No Javadoc available for %s" symbol-name)))))
11381138

11391139
(defun cider-javadoc (arg)
11401140
"Open Javadoc documentation in a popup buffer.
@@ -1270,7 +1270,7 @@ This is used by pretty-printing commands and intentionally discards their result
12701270
(let ((buffer (get-buffer cider-error-buffer)))
12711271
(if buffer
12721272
(cider-popup-buffer-display buffer cider-auto-select-error-buffer)
1273-
(error "No %s buffer" cider-error-buffer))))
1273+
(user-error "No %s buffer" cider-error-buffer))))
12741274

12751275
(defun cider-find-property (property &optional backward)
12761276
"Find the next text region which has the specified PROPERTY.
@@ -1965,7 +1965,7 @@ Defaults to the current ns. With prefix arg QUERY, prompts for a ns."
19651965
"Look up documentation for SYMBOL."
19661966
(-if-let (buffer (cider-create-doc-buffer symbol))
19671967
(cider-popup-buffer-display buffer t)
1968-
(error "Symbol %s not resolved" symbol)))
1968+
(user-error "Symbol %s not resolved" symbol)))
19691969

19701970
(defun cider-doc (&optional arg)
19711971
"Open Clojure documentation in a popup buffer.
@@ -2046,7 +2046,7 @@ The heavy lifting is done by `cider-load-file'."
20462046
(setq buffer (or buffer (current-buffer)))
20472047
(with-current-buffer buffer
20482048
(unless buffer-file-name
2049-
(error "Buffer %s is not associated with a file" (buffer-name)))
2049+
(user-error "Buffer %s is not associated with a file" (buffer-name)))
20502050
(when (and cider-prompt-save-file-on-load
20512051
(buffer-modified-p)
20522052
(y-or-n-p (format "Save file %s? " buffer-file-name)))

0 commit comments

Comments
 (0)