summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorMark Oteiza <mvoteiza@udel.edu>2020-02-13 19:57:44 -0500
committerMark Oteiza <mvoteiza@udel.edu>2020-02-13 19:57:44 -0500
commitb80c4b43dd47bf44c45bdab3e6f8b4b66a461074 (patch)
tree3a5d658c013d94df74dbfa89b4965b6719bd6b50 /lisp
parent44298ea6aa006ed227e539b02279bd3fc11fd2a6 (diff)
downloademacs-b80c4b43dd47bf44c45bdab3e6f8b4b66a461074.tar.gz
Add an appropriate error for reading bad JSON arrays
* lisp/json.el (json-array-format): New error. (json-read-array): Use it.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/json.el3
1 files changed, 2 insertions, 1 deletions
diff --git a/lisp/json.el b/lisp/json.el
index 18d7fda8822..055f3f5be11 100644
--- a/lisp/json.el
+++ b/lisp/json.el
@@ -227,6 +227,7 @@ Unlike `reverse', this keeps the property-value pairs intact."
(define-error 'json-string-format "Bad string format" 'json-error)
(define-error 'json-key-format "Bad JSON object key" 'json-error)
(define-error 'json-object-format "Bad JSON object" 'json-error)
+(define-error 'json-array-format "Bad JSON array" 'json-error)
(define-error 'json-end-of-file "End of file while parsing JSON"
'(end-of-file json-error))
@@ -640,7 +641,7 @@ become JSON objects."
(when (/= (json-peek) ?\])
(if (= (json-peek) ?,)
(json-advance)
- (signal 'json-error (list 'bleah)))))
+ (signal 'json-array-format (list ?, (json-peek))))))
;; Skip over the "]"
(json-advance)
(pcase json-array-type