Skip to content

Commit

Permalink
Merge pull request #1200 from Malabarba/master
Browse files Browse the repository at this point in the history
Improve some error-handling
  • Loading branch information
bbatsov committed Jul 12, 2015
2 parents b4573a8 + 32fe4c3 commit cf625a1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions cider-debug.el
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ needed. It is expected to contain at least \"key\", \"input-type\", and
\"prompt\", and possibly other entries depending on the input-type."
(nrepl-dbind-response response (debug-value key coor code file point ns original-id
input-type prompt inspect)
(condition-case nil
(condition-case-unless-debug e
(progn
(pcase input-type
("expression" (cider-debug-mode-send-reply (cider-read-from-minibuffer
Expand All @@ -494,7 +494,7 @@ needed. It is expected to contain at least \"key\", \"input-type\", and
(cider-inspector--done-handler (current-buffer))))
;; If something goes wrong, we send a "quit" or the session hangs.
(error (cider-debug-mode-send-reply ":quit" key)
(cider-popup-buffer-quit-function (not (buffer-modified-p)))))))
(message "Error encountered while handling the debug message: %S" e)))))


;;; User commands
Expand Down
14 changes: 7 additions & 7 deletions cider-interaction.el
Original file line number Diff line number Diff line change
Expand Up @@ -943,15 +943,15 @@ Display the results in a different window."
(progn
(if line (setq info (nrepl-dict-put info "line" line)))
(cider--jump-to-loc-from-info info t))
(error "Symbol %s not resolved" var)))
(user-error "Symbol %s not resolved" var)))

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

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

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

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

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

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

0 comments on commit cf625a1

Please sign in to comment.