mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
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.
This commit is contained in:
parent
ac26024837
commit
9c9547a628
16
yasnippet.el
16
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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user