diff mercurial/templater.py @ 28628:ed1d90f6e921

templater: do not abuse SyntaxError to report errors in template map file SyntaxError is the class representing syntax errors in Python code. We should use a dedicated exception class for our needs. With this change, unnecessary re-wrapping of SyntaxError can be eliminated.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 26 Mar 2016 18:01:04 +0900
parents 73d01cba5810
children bf35644b9f3a
line wrap: on
line diff
--- a/mercurial/templater.py	Wed Mar 23 13:34:47 2016 -0700
+++ b/mercurial/templater.py	Sat Mar 26 18:01:04 2016 +0900
@@ -978,13 +978,12 @@
 
         for key, val in conf[''].items():
             if not val:
-                raise SyntaxError(_('%s: missing value') % conf.source('', key))
+                raise error.ParseError(_('missing value'), conf.source('', key))
             if val[0] in "'\"":
                 try:
                     self.cache[key] = unquotestring(val)
                 except SyntaxError as inst:
-                    raise SyntaxError('%s: %s' %
-                                      (conf.source('', key), inst.args[0]))
+                    raise error.ParseError(inst.args[0], conf.source('', key))
             else:
                 val = 'default', val
                 if ':' in val[1]: