diff options
| author | Stefan Monnier | 2026-03-08 23:28:11 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2026-03-08 23:28:11 -0400 |
| commit | 225977cda7c819c3bbf018d870c0eedfa92023bd (patch) | |
| tree | b81e3e98b3cb651f47ddc96bb926ec62fe0d5fa7 /lisp/net | |
| parent | 0349286fb6c4d4b4c67b5ae0e51e8ece196fbfb9 (diff) | |
| download | emacs-feature/error-API.tar.gz emacs-feature/error-API.zip | |
Use the new error API functionsfeature/error-API
* lisp/epa-file.el (epa-file--find-file-not-found-function):
Use `error-slot-value` and `error-data`.
(epa-file-insert-file-contents): Use `error-has-type-p`,
`error-slot-value`, and `error-data`.
* lisp/jka-compr.el (jka-compr-insert-file-contents):
Use `error-has-type-p` and `error-slot-value` as well as new
re-signaling form of `signal`.
* lisp/simple.el (minibuffer-error-function): Use `error-has-type-p`.
* lisp/startup.el (startup--load-user-init-file):
Use `error-message-string`.
(command-line): Use `error-has-type-p` and `error-message-string`.
* lisp/type-break.el (type-break-demo-life):
Use `error-message-string`.
* lisp/emacs-lisp/bytecomp.el (batch-byte-compile-file):
Use `error-message-string` and `error-has-type-p`.
* lisp/emacs-lisp/edebug.el (edebug-safe-eval, edebug-report-error)
(edebug-eval-expression):
* lisp/emacs-lisp/debug.el (debugger-eval-expression):
Use `error-message-string`.
* lisp/emacs-lisp/ert.el (ert--should-error-handle-error):
Use `error-has-type-p` and `error-type`.
* lisp/net/sasl.el (sasl-error): Use `define-error`.
* lisp/net/tramp-compat.el (tramp-error-type-p): New function.
(tramp-permission-denied, tramp-compat-permission-denied): Use it.
* lisp/progmodes/elisp-mode.el (elisp-completion-at-point):
Use `error-type-p`.
Diffstat (limited to 'lisp/net')
| -rw-r--r-- | lisp/net/sasl.el | 3 | ||||
| -rw-r--r-- | lisp/net/soap-client.el | 2 | ||||
| -rw-r--r-- | lisp/net/tramp-compat.el | 9 | ||||
| -rw-r--r-- | lisp/net/tramp-message.el | 4 |
4 files changed, 13 insertions, 5 deletions
diff --git a/lisp/net/sasl.el b/lisp/net/sasl.el index 289e867e672..3f805237683 100644 --- a/lisp/net/sasl.el +++ b/lisp/net/sasl.el | |||
| @@ -50,8 +50,7 @@ | |||
| 50 | 50 | ||
| 51 | (defvar sasl-unique-id-function #'sasl-unique-id-function) | 51 | (defvar sasl-unique-id-function #'sasl-unique-id-function) |
| 52 | 52 | ||
| 53 | (put 'sasl-error 'error-message "SASL error") | 53 | (define-error 'sasl-error "SASL error") |
| 54 | (put 'sasl-error 'error-conditions '(sasl-error error)) | ||
| 55 | 54 | ||
| 56 | (defun sasl-error (datum) | 55 | (defun sasl-error (datum) |
| 57 | (signal 'sasl-error (list datum))) | 56 | (signal 'sasl-error (list datum))) |
diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el index beebe9b4445..f6d2ba229e5 100644 --- a/lisp/net/soap-client.el +++ b/lisp/net/soap-client.el | |||
| @@ -2886,7 +2886,7 @@ decode function to perform the actual decoding." | |||
| 2886 | 2886 | ||
| 2887 | ;;;; Soap Envelope parsing | 2887 | ;;;; Soap Envelope parsing |
| 2888 | 2888 | ||
| 2889 | (if (fboundp 'define-error) | 2889 | (if (fboundp 'define-error) ;Emacs-24.4 |
| 2890 | (define-error 'soap-error "SOAP error") | 2890 | (define-error 'soap-error "SOAP error") |
| 2891 | ;; Support Emacs<24.4 that do not have define-error, so | 2891 | ;; Support Emacs<24.4 that do not have define-error, so |
| 2892 | ;; that soap-client can remain unchanged in GNU ELPA. | 2892 | ;; that soap-client can remain unchanged in GNU ELPA. |
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index f975457d4df..ecc6fe96855 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el | |||
| @@ -102,14 +102,19 @@ Add the extension of F, if existing." | |||
| 102 | tramp-temp-name-prefix tramp-compat-temporary-file-directory) | 102 | tramp-temp-name-prefix tramp-compat-temporary-file-directory) |
| 103 | dir-flag (file-name-extension f t))) | 103 | dir-flag (file-name-extension f t))) |
| 104 | 104 | ||
| 105 | (defalias 'tramp-error-type-p | ||
| 106 | (if (fboundp 'error-type-p) ;Emacs-31 | ||
| 107 | #'error-type-p | ||
| 108 | (lambda (symbol) (get symbol 'error-conditions)))) | ||
| 109 | |||
| 105 | ;; `permission-denied' is introduced in Emacs 29.1. | 110 | ;; `permission-denied' is introduced in Emacs 29.1. |
| 106 | (defconst tramp-permission-denied | 111 | (defconst tramp-permission-denied |
| 107 | (if (get 'permission-denied 'error-conditions) 'permission-denied 'file-error) | 112 | (if (tramp-error-type-p 'permission-denied) 'permission-denied 'file-error) |
| 108 | "The error symbol for the `permission-denied' error.") | 113 | "The error symbol for the `permission-denied' error.") |
| 109 | 114 | ||
| 110 | (defsubst tramp-compat-permission-denied (vec file) | 115 | (defsubst tramp-compat-permission-denied (vec file) |
| 111 | "Emit the `permission-denied' error." | 116 | "Emit the `permission-denied' error." |
| 112 | (if (get 'permission-denied 'error-conditions) | 117 | (if (tramp-error-type-p 'permission-denied) |
| 113 | (tramp-error vec tramp-permission-denied file) | 118 | (tramp-error vec tramp-permission-denied file) |
| 114 | (tramp-error vec tramp-permission-denied "Permission denied: %s" file))) | 119 | (tramp-error vec tramp-permission-denied "Permission denied: %s" file))) |
| 115 | 120 | ||
diff --git a/lisp/net/tramp-message.el b/lisp/net/tramp-message.el index 7b405061ba8..37628e2f001 100644 --- a/lisp/net/tramp-message.el +++ b/lisp/net/tramp-message.el | |||
| @@ -398,8 +398,12 @@ FMT-STRING and ARGUMENTS." | |||
| 398 | vec-or-proc 1 "%s" | 398 | vec-or-proc 1 "%s" |
| 399 | (error-message-string | 399 | (error-message-string |
| 400 | (list signal | 400 | (list signal |
| 401 | ;; FIXME: Looks redundant since `error-message-string' | ||
| 402 | ;; already uses the `error-message' property of `signal'! | ||
| 401 | (get signal 'error-message) | 403 | (get signal 'error-message) |
| 402 | (apply #'format-message fmt-string arguments)))) | 404 | (apply #'format-message fmt-string arguments)))) |
| 405 | ;; FIXME: This doesn't look right: ELisp code should be able to rely on | ||
| 406 | ;; the "shape" of the list based on the type of the signal. | ||
| 403 | (signal signal (list (substring-no-properties | 407 | (signal signal (list (substring-no-properties |
| 404 | (apply #'format-message fmt-string arguments)))))) | 408 | (apply #'format-message fmt-string arguments)))))) |
| 405 | 409 | ||