templater: specialize ResourceUnavailable error so that it can be caught
authorYuya Nishihara <yuya@tcha.org>
Sun, 25 Feb 2018 12:50:30 +0900
changeset 36444 717a279c0c21
parent 36443 8dbd97aef915
child 36445 e8d37838f5df
templater: specialize ResourceUnavailable error so that it can be caught See the next patch how it will be used.
mercurial/templater.py
--- 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):