diff --git a/etc/NEWS b/etc/NEWS index c0e404f8106..0e2a6849ca6 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -4011,11 +4011,11 @@ that will provide an Xref backend when used. +++ ** The API to manipulate error descriptors has been improved. -there are new functions: 'error-type-p', 'error-type', +There are new functions: 'error-type-p', 'error-type', 'error-has-type-p', and 'error-slot-value'. -And you can now do (signal err) instead (signal (car err) (cdr err)), which -is not just more concise but also preserves the 'eq'uality of the -error descriptor. +And you can now do '(signal err)' instead of +'(signal (car err) (cdr err))', which is not only more concise +but also preserves the 'eq'uality of the error descriptor. +++ ** 'secure-hash' now supports generating SHA-3 message digests. diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 6dacd568c7a..1c2df07f137 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -399,8 +399,8 @@ and aborts the current test as failed if it doesn't." (let ((handled-conditions (pcase-exhaustive type ((pred listp) type) ((pred symbolp) (list type))))) - (unless (cl-some (lambda (hc) (error-has-type-p condition hc)) - handled-conditions) + (unless (any (lambda (hc) (error-has-type-p condition hc)) + handled-conditions) (ert-fail (append (funcall form-description-fn) (list diff --git a/lisp/epa-file.el b/lisp/epa-file.el index e45dbd1754e..b2a89907867 100644 --- a/lisp/epa-file.el +++ b/lisp/epa-file.el @@ -116,7 +116,7 @@ encryption is used." (defun epa-file--find-file-not-found-function () (let ((error epa-file-error)) (save-window-excursion - (kill-buffer)) + (kill-buffer)) ;; FIXME: How do we know that slot 3 can hold only a message related ;; to a wrong passphrase? (if (error-slot-value error 3) @@ -140,8 +140,9 @@ encryption is used." error-string) (match-string 1 error-string)))) -(defun epa-file--error-add-context (err ctxt) - (setf (cdr error) (append (cdr error) (list ctx)))) +(defun epa-file--error-add-context (error context) + "Append CONTEXT to ERROR data by side effect." + (setf (cdr error) (append (cdr error) (list context)))) (defvar last-coding-system-used) (defun epa-file-insert-file-contents (file &optional visit beg end replace) diff --git a/lisp/ffap.el b/lisp/ffap.el index aa8dffc9dcd..800437d69c9 100644 --- a/lisp/ffap.el +++ b/lisp/ffap.el @@ -474,8 +474,8 @@ Returned values: ;; (file-error "Connection failed" "address already in use" ;; "ftp.uu.net" "ffap-machine-p") ((equal mesg "connection failed") - (if (string= (downcase (error-slot-value error 2)) - "permission denied") + (if (string-equal-ignore-case (error-slot-value error 2) + "permission denied") nil ; host does not exist ;; Other errors mean the host exists: (error-slot-value error 2))) diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el index 76626541bf2..2e9adeec23d 100644 --- a/lisp/gnus/gnus-search.el +++ b/lisp/gnus/gnus-search.el @@ -2087,7 +2087,7 @@ Assume \"size\" key is equal to \"larger\"." (apply #'nnheader-message 4 "Search engine for %s improperly configured: %s" server (error-slot-value err 1)) - (signal err err))))) + (signal err))))) (alist-get 'search-group-spec specs)) ;; Some search engines do their own limiting, but some don't, so ;; do it again here. This is bad because, if the user is diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el index bb80c2551ae..750ebc413b6 100644 --- a/lisp/gnus/nnmaildir.el +++ b/lisp/gnus/nnmaildir.el @@ -364,7 +364,7 @@ This variable is set by `nnmaildir-request-article'.") (defun nnmaildir--emlink-p (err) (and (error-has-type-p err 'file-error) - (string= (downcase (error-slot-value err 2)) "too many links"))) + (string-equal-ignore-case (error-slot-value err 2) "too many links"))) (defun nnmaildir--enoent-p (err) (error-has-type-p err 'file-missing)) diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index 6777d652c44..04cc631ba6f 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -1131,7 +1131,7 @@ a new window in the current frame, splitting vertically." (and (stringp msg) ;; This definitely falls in the ;; ghetto hack category... - (not (string-match-p "too small" msg))))) + (not (string-search "too small" msg))))) (signal err) (enlarge-window 3)))))) (select-window (next-window)) diff --git a/test/lisp/vc/vc-tests/vc-tests.el b/test/lisp/vc/vc-tests/vc-tests.el index 737ee09415e..a64bee00de2 100644 --- a/test/lisp/vc/vc-tests/vc-tests.el +++ b/test/lisp/vc/vc-tests/vc-tests.el @@ -236,7 +236,7 @@ For backends which don't support it, `vc-not-supported' is signaled." (defmacro vc-test--run-maybe-unsupported-function (func &rest args) "Run FUNC with ARGS as arguments. Catch the `vc-not-supported' error." - `(condition-case err + `(condition-case nil (funcall ,func ,@args) (vc-not-supported 'vc-not-supported)))