Function: jsonrpc-error
jsonrpc-error is a byte-compiled function defined in jsonrpc.el.gz.
Signature
(jsonrpc-error &rest ARGS)
Documentation
Error out with FORMAT and ARGS.
If invoked inside a dispatcher function, this function is suitable for replying to the remote endpoint with an error message.
ARGS can be of the form (FORMAT-STRING . MOREARGS) for replying with a -32603 error code and a message formed by formatting FORMAT-STRING with MOREARGS.
Alternatively ARGS can be plist representing a JSONRPC error object, using the keywords :code, :message and :data.
Source Code
;; Defined in /usr/src/emacs/lisp/jsonrpc.el.gz
;;; Contacting the remote endpoint
;;;
(defun jsonrpc-error (&rest args)
"Error out with FORMAT and ARGS.
If invoked inside a dispatcher function, this function is suitable
for replying to the remote endpoint with an error message.
ARGS can be of the form (FORMAT-STRING . MOREARGS) for replying
with a -32603 error code and a message formed by formatting
FORMAT-STRING with MOREARGS.
Alternatively ARGS can be plist representing a JSONRPC error
object, using the keywords `:code', `:message' and `:data'."
(if (stringp (car args))
(let ((msg
(apply #'format-message (car args) (cdr args))))
(signal 'jsonrpc-error
`(,msg
(jsonrpc-error-code . ,32603)
(jsonrpc-error-message . ,msg))))
(cl-destructuring-bind (&key code message data) args
(signal 'jsonrpc-error
`("[jsonrpc] error "
(jsonrpc-error-code . ,code)
(jsonrpc-error-message . ,message)
(jsonrpc-error-data . ,data))))))