mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-06-14 12:31:25 +00:00
Tweak recent error descriptor changes
* etc/NEWS: Fix capitalization and markup. * lisp/emacs-lisp/ert.el (ert--should-error-handle-error): Prefer any over cl-some where either will do. * lisp/epa-file.el (epa-file--find-file-not-found-function): Reindent. (epa-file--error-add-context): Use correct variables. Add docstring. * lisp/ffap.el (ffap-machine-p): * lisp/gnus/nnmaildir.el (nnmaildir--emlink-p): Prefer string-equal-ignore-case over case fiddling. * lisp/gnus/gnus-search.el (gnus-search-run-query): Fix typo in error re-signaling. * lisp/ibuffer.el (ibuffer-confirm-operation-on): Prefer string search over regexp matching where either will do. * test/lisp/vc/vc-tests/vc-tests.el (vc-test--run-maybe-unsupported-function): Pacify unused condition-case error variable warnings (bug#72212).
This commit is contained in:
parent
261f4a012e
commit
8d356c55ad
8 changed files with 16 additions and 15 deletions
8
etc/NEWS
8
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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)))
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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)))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue