changeset 36444:717a279c0c21

templater: specialize ResourceUnavailable error so that it can be caught See the next patch how it will be used.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 25 Feb 2018 12:50:30 +0900
parents 8dbd97aef915
children e8d37838f5df
files mercurial/templater.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templater.py	Sun Feb 25 12:47:53 2018 +0900
+++ b/mercurial/templater.py	Sun Feb 25 12:50:30 2018 +0900
@@ -30,6 +30,9 @@
     util,
 )
 
+class ResourceUnavailable(error.Abort):
+    pass
+
 class TemplateNotFound(error.Abort):
     pass
 
@@ -1377,7 +1380,8 @@
         if v is None:
             v = self._resources.get(key)
         if v is None:
-            raise error.Abort(_('template resource not available: %s') % key)
+            raise ResourceUnavailable(_('template resource not available: %s')
+                                      % key)
         return v
 
     def _load(self, t):