Function: vertico--protect

vertico--protect is a byte-compiled function defined in vertico.el.

Signature

(vertico--protect FUN)

Documentation

Protect FUN such that errors are caught.

If an error occurs, the FUN is retried with debug-on-error enabled and the stack trace is shown in the *Messages* buffer.

Source Code

;; Defined in ~/.emacs.d/elpa/vertico-20260811.1003/vertico.el
(defun vertico--protect (fun)
  "Protect FUN such that errors are caught.
If an error occurs, the FUN is retried with `debug-on-error' enabled and
the stack trace is shown in the *Messages* buffer."
  (static-if (fboundp 'handler-bind) ;; Available on Emacs 30
      (ignore-errors
        (handler-bind ((error #'vertico--debug))
          (funcall fun)))
    (when (or debug-on-error (condition-case nil
                                 (progn (funcall fun) nil)
                               (error t)))
      (let ((debug-on-error t)
            (debugger #'vertico--debug))
        (condition-case nil
            (funcall fun)
          ((debug error) nil))))))