diff options
| author | João Távora | 2023-03-14 19:07:23 +0000 |
|---|---|---|
| committer | João Távora | 2023-03-14 19:36:47 +0000 |
| commit | 2d835d64ba339bb375f0d55c4679149d6da3f209 (patch) | |
| tree | 108faa939f37b16b4a9b39d369cbb043f877b7d9 /test | |
| parent | a55aaf9eaf203a4aedb0a492de2c33ab54b0b11c (diff) | |
| download | emacs-2d835d64ba339bb375f0d55c4679149d6da3f209.tar.gz emacs-2d835d64ba339bb375f0d55c4679149d6da3f209.zip | |
Better jsonrpc.el workaround for debug-on-error check
Some extensions, notably ert.el, set `debug-on-error' to non-nil,
which makes it hard to test the behaviour catching of the Elisp
error when processing a request and replying to the endpoint with
an JSONRPC-error.
The previous workaround relied on requiring lisp/emacs-lisp/ert.el in
lisp/jsonrpc.el, which really doesn't make sense.
This is better. For the single test of that behaviour, set a new
variable, jsonrpc-inhibit-debug-on-error.
Not only is this cleaner, it allows us to use ert.el's useful
debug-on-error setting.
* lisp/jsonrpc.el (ert): Don't require it.
(jsonrpc-inhibit-debug-on-error): New variable.
(jsonrpc-connection-receive): Use it.
(Package-Requires): Bump to 1.0.17
* test/lisp/jsonrpc-tests.el (signals-an--32603-JSONRPC-error):
Bind jsonrpc-inhibit-debug-on-error.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/jsonrpc-tests.el | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test/lisp/jsonrpc-tests.el b/test/lisp/jsonrpc-tests.el index a595167d130..85ac96a931c 100644 --- a/test/lisp/jsonrpc-tests.el +++ b/test/lisp/jsonrpc-tests.el | |||
| @@ -124,7 +124,7 @@ | |||
| 124 | "Signals an -32603 JSONRPC error." | 124 | "Signals an -32603 JSONRPC error." |
| 125 | (jsonrpc--with-emacsrpc-fixture (conn) | 125 | (jsonrpc--with-emacsrpc-fixture (conn) |
| 126 | (condition-case err | 126 | (condition-case err |
| 127 | (progn | 127 | (let ((jsonrpc-inhibit-debug-on-error t)) |
| 128 | (jsonrpc-request conn '+ ["a" 2]) | 128 | (jsonrpc-request conn '+ ["a" 2]) |
| 129 | (ert-fail "A `jsonrpc-error' should have been signaled!")) | 129 | (ert-fail "A `jsonrpc-error' should have been signaled!")) |
| 130 | (jsonrpc-error | 130 | (jsonrpc-error |