From 54bd972f159fb8c25b4f4042ac6db5da557d9108 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 9 Aug 2013 17:22:44 -0400 Subject: * lisp/subr.el (define-error): New function. * doc/lispref/control.texi (Signaling Errors): Refer to define-error. (Error Symbols): Add `define-error'. * doc/lispref/errors.texi (Standard Errors): Don't refer to `error-conditions'. * lisp/progmodes/ada-xref.el (ada-error-file-not-found): Rename from error-file-not-found and define with define-error. * lisp/emacs-lisp/cl-lib.el (cl-assertion-failed): Move here from subr.el and define with define-error. * lisp/userlock.el (file-locked, file-supersession): * lisp/simple.el (mark-inactive): * lisp/progmodes/js.el (js-moz-bad-rpc, js-js-error): * lisp/progmodes/ada-mode.el (ada-mode-errors): * lisp/play/life.el (life-extinct): * lisp/nxml/xsd-regexp.el (xsdre-invalid-regexp, xsdre-parse-error): * lisp/nxml/xmltok.el (xmltok-markup-declaration-parse-error): * lisp/nxml/rng-util.el (rng-error): * lisp/nxml/rng-uri.el (rng-uri-error): * lisp/nxml/rng-match.el (rng-compile-error): * lisp/nxml/rng-cmpct.el (rng-c-incorrect-schema): * lisp/nxml/nxml-util.el (nxml-error, nxml-file-parse-error): * lisp/nxml/nxml-rap.el (nxml-scan-error): * lisp/nxml/nxml-outln.el (nxml-outline-error): * lisp/net/soap-client.el (soap-error): * lisp/net/gnutls.el (gnutls-error): * lisp/net/ange-ftp.el (ftp-error): * lisp/mpc.el (mpc-proc-error): * lisp/json.el (json-error, json-readtable-error, json-unknown-keyword) (json-number-format, json-string-escape, json-string-format) (json-key-format, json-object-format): * lisp/jka-compr.el (compression-error): * lisp/international/quail.el (quail-error): * lisp/international/kkc.el (kkc-error): * lisp/emacs-lisp/ert.el (ert-test-failed): * lisp/calc/calc.el (calc-error, inexact-result, math-overflow) (math-underflow): * lisp/bookmark.el (bookmark-error-no-filename): * lisp/epg.el (epg-error): Define with define-error. --- lisp/json.el | 38 ++++++++------------------------------ 1 file changed, 8 insertions(+), 30 deletions(-) (limited to 'lisp/json.el') diff --git a/lisp/json.el b/lisp/json.el index 29beaedebe9..aaa7bb0c499 100644 --- a/lisp/json.el +++ b/lisp/json.el @@ -177,36 +177,14 @@ without indentation.") ;; Error conditions -(put 'json-error 'error-message "Unknown JSON error") -(put 'json-error 'error-conditions '(json-error error)) - -(put 'json-readtable-error 'error-message "JSON readtable error") -(put 'json-readtable-error 'error-conditions - '(json-readtable-error json-error error)) - -(put 'json-unknown-keyword 'error-message "Unrecognized keyword") -(put 'json-unknown-keyword 'error-conditions - '(json-unknown-keyword json-error error)) - -(put 'json-number-format 'error-message "Invalid number format") -(put 'json-number-format 'error-conditions - '(json-number-format json-error error)) - -(put 'json-string-escape 'error-message "Bad Unicode escape") -(put 'json-string-escape 'error-conditions - '(json-string-escape json-error error)) - -(put 'json-string-format 'error-message "Bad string format") -(put 'json-string-format 'error-conditions - '(json-string-format json-error error)) - -(put 'json-key-format 'error-message "Bad JSON object key") -(put 'json-key-format 'error-conditions - '(json-key-format json-error error)) - -(put 'json-object-format 'error-message "Bad JSON object") -(put 'json-object-format 'error-conditions - '(json-object-format json-error error)) +(define-error 'json-error "Unknown JSON error") +(define-error 'json-readtable-error "JSON readtable error" 'json-error) +(define-error 'json-unknown-keyword "Unrecognized keyword" 'json-error) +(define-error 'json-number-format "Invalid number format" 'json-error) +(define-error 'json-string-escape "Bad Unicode escape" 'json-error) +(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) -- cgit v1.2.1