branch: master commit 9c9547a6281ecdac0a27cef843befa4271a5eefa Author: Noam Postavsky <npost...@users.sourceforge.net> Commit: Noam Postavsky <npost...@users.sourceforge.net>
Don't catch and rethrow yas-{-}exception * yasnippet.el (yas--eval-for-string): Don't catch yas--exception. (yas-throw): Signal `yas-exception', not `yas--exception'; DATA must be a list. (yas-exception): Add `error-message' property. (yas-verify-value): Just use plain format since the new `error-message' property for `yas-exception' will add the right prefix. --- yasnippet.el | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/yasnippet.el b/yasnippet.el index 44545c0..4258d14 100644 --- a/yasnippet.el +++ b/yasnippet.el @@ -1344,7 +1344,6 @@ Returns (TEMPLATES START END). This function respects (if (memq yas-good-grace '(t inline)) (condition-case oops (funcall eval-saving-stuff form) - (yas--exception (signal 'yas-exception (cdr oops))) (error (cdr oops))) (funcall eval-saving-stuff form)))) @@ -2855,17 +2854,16 @@ The last element of POSSIBILITIES may be a list of strings." key))))) (defun yas-throw (text) - "Throw a yas--exception with TEXT as the reason." - (signal 'yas--exception text)) -(put 'yas--exception 'error-conditions '(error yas--exception)) + "Signal `yas-exception' with TEXT as the reason." + (signal 'yas-exception (list text))) +(put 'yas-exception 'error-conditions '(error yas-exception)) +(put 'yas-exception 'error-message "[yas] Exception") (defun yas-verify-value (possibilities) "Verify that the current field value is in POSSIBILITIES. - -Otherwise throw exception." - (when (and yas-moving-away-p - (cl-notany (lambda (pos) (string= pos yas-text)) possibilities)) - (yas-throw (yas--format "Field only allows %s" possibilities)))) +Otherwise signal `yas-exception'." + (when (and yas-moving-away-p (cl-notany (lambda (pos) (string= pos yas-text)) possibilities)) + (yas-throw (format "Field only allows %s" possibilities)))) (defun yas-field-value (number) "Get the string for field with NUMBER.