aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/emacs-lisp/ert.el
diff options
context:
space:
mode:
authorStefan Monnier2026-03-08 23:28:11 -0400
committerStefan Monnier2026-03-08 23:28:11 -0400
commit225977cda7c819c3bbf018d870c0eedfa92023bd (patch)
treeb81e3e98b3cb651f47ddc96bb926ec62fe0d5fa7 /lisp/emacs-lisp/ert.el
parent0349286fb6c4d4b4c67b5ae0e51e8ece196fbfb9 (diff)
downloademacs-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/emacs-lisp/ert.el')
-rw-r--r--lisp/emacs-lisp/ert.el9
1 files changed, 4 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index d5e0afe3b92..6dacd568c7a 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -396,12 +396,11 @@ Returns nil."
396 396
397Determines whether CONDITION matches TYPE and EXCLUDE-SUBTYPES, 397Determines whether CONDITION matches TYPE and EXCLUDE-SUBTYPES,
398and aborts the current test as failed if it doesn't." 398and aborts the current test as failed if it doesn't."
399 (let ((signaled-conditions (get (car condition) 'error-conditions)) 399 (let ((handled-conditions (pcase-exhaustive type
400 (handled-conditions (pcase-exhaustive type
401 ((pred listp) type) 400 ((pred listp) type)
402 ((pred symbolp) (list type))))) 401 ((pred symbolp) (list type)))))
403 (cl-assert signaled-conditions) 402 (unless (cl-some (lambda (hc) (error-has-type-p condition hc))
404 (unless (cl-intersection signaled-conditions handled-conditions) 403 handled-conditions)
405 (ert-fail (append 404 (ert-fail (append
406 (funcall form-description-fn) 405 (funcall form-description-fn)
407 (list 406 (list
@@ -409,7 +408,7 @@ and aborts the current test as failed if it doesn't."
409 :fail-reason (concat "the error signaled did not" 408 :fail-reason (concat "the error signaled did not"
410 " have the expected type"))))) 409 " have the expected type")))))
411 (when exclude-subtypes 410 (when exclude-subtypes
412 (unless (member (car condition) handled-conditions) 411 (unless (member (error-type condition) handled-conditions)
413 (ert-fail (append 412 (ert-fail (append
414 (funcall form-description-fn) 413 (funcall form-description-fn)
415 (list 414 (list