[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master a8dbb7c: Follow JSONRPC spec by not sending :result field on erro
From: |
João Távora |
Subject: |
master a8dbb7c: Follow JSONRPC spec by not sending :result field on errors |
Date: |
Tue, 5 Nov 2019 18:39:36 -0500 (EST) |
branch: master
commit a8dbb7cc865f227a39708df3fe8d24e6f52b6e28
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Follow JSONRPC spec by not sending :result field on errors
Also don't send :error field on non-errors.
* lisp/jsonrpc.el (jsonrpc--reply): Don't send :result and :error
if none supplied.
(Version): Bump to 1.0.8
---
lisp/jsonrpc.el | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el
index 41cd846..abab445 100644
--- a/lisp/jsonrpc.el
+++ b/lisp/jsonrpc.el
@@ -5,7 +5,7 @@
;; Author: João Távora <address@hidden>
;; Keywords: processes, languages, extensions
;; Package-Requires: ((emacs "25.2"))
-;; Version: 1.0.7
+;; Version: 1.0.8
;; This is an Elpa :core package. Don't use functionality that is not
;; compatible with Emacs 25.2.
@@ -460,9 +460,13 @@ With optional CLEANUP, kill any associated buffers."
(json-null nil))
(json-encode object)))))
-(cl-defun jsonrpc--reply (connection id &key (result nil result-supplied-p)
error)
+(cl-defun jsonrpc--reply
+ (connection id &key (result nil result-supplied-p) (error nil
error-supplied-p))
"Reply to CONNECTION's request ID with RESULT or ERROR."
- (jsonrpc-connection-send connection :id id :result result :error error))
+ (apply #'jsonrpc-connection-send connection
+ `(:id ,id
+ ,@(and result-supplied-p `(:result ,result))
+ ,@(and error-supplied-p `(:error ,error)))))
(defun jsonrpc--call-deferred (connection)
"Call CONNECTION's deferred actions, who may again defer themselves."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master a8dbb7c: Follow JSONRPC spec by not sending :result field on errors,
João Távora <=