emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 9c9547a 21/63: Don't catch and rethrow yas-{-}exception


From: Noam Postavsky
Subject: [elpa] master 9c9547a 21/63: Don't catch and rethrow yas-{-}exception
Date: Mon, 17 Jul 2017 22:54:13 -0400 (EDT)

branch: master
commit 9c9547a6281ecdac0a27cef843befa4271a5eefa
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]