Skip to content

Commit

Permalink
Report problems of type java.lang.Error back to the nREPL client
Browse files Browse the repository at this point in the history
Error inherits directly from Throwable, so Errors are not Exceptions, they need
to be handled separately. This category includes RuntimeError,
StackOverflowError, and NoClassDefFoundError.

In regular applications you would not catch these, but in our case letting them
bubble means the nREPL handler dies without returning a response, causing the
client to assume that the operation is taking too long and time out, without any
useful feedback.

This is bad UX, and it makes it hard to diagnose and debug problems like clojure-emacs#184.
At least this way the user will see a stack trace that hints at the problem.
  • Loading branch information
plexus committed Jan 22, 2017
1 parent 56a1c67 commit 5728a39
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Bugs fixed

*
* [#185](https://github.com/clojure-emacs/refactor-nrepl/issues/185) Report throwables of type `Error` instead of swallowing them.
* [clojure-emacs/clj-refactor.el#330](https://github.com/clojure-emacs/clj-refactor.el/issues/332) `clean-ns` removes imported inner inner classes.
* [clojure-emacs/clj-refactor.el#330](https://github.com/clojure-emacs/clj-refactor.el/issues/330) `clean-ns` ignores namespaced keywords.
* [#160](https://github.com/clojure-emacs/refactor-nrepl/issues/160) Make `resolve-missing` find newly defined vars and types (clj). Because of a stale cache, newly added vars or types would not be found. This fix takes into account vars/types added by eval-ing code (rescan affected namespace), and by hotloading dependencies (reset the cache).
Expand Down
3 changes: 3 additions & 0 deletions src/refactor_nrepl/middleware.clj
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
(transport/send
~transport (response-for ~msg :error (.getMessage e#) :status :done)))
(catch Exception e#
(transport/send
~transport (response-for ~msg (err-info e# :refactor-nrepl-error))))
(catch Error e#
(transport/send
~transport (response-for ~msg (err-info e# :refactor-nrepl-error))))))

Expand Down

0 comments on commit 5728a39

Please sign in to comment.