Commit b80c4b43 authored by Mark Oteiza's avatar Mark Oteiza

Add an appropriate error for reading bad JSON arrays

* lisp/json.el (json-array-format): New error.
(json-read-array): Use it.
parent 44298ea6
Pipeline #4789 passed with stage
in 54 minutes and 43 seconds
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment