[PATCH 11 of 11] templater: drop global exception catcher from runfilter() (API)

Yuya Nishihara yuya at tcha.org
Fri Mar 30 21:49:39 EDT 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1521359827 -32400
#      Sun Mar 18 16:57:07 2018 +0900
# Node ID 9a2646947602dd11d7f65422e3ea27fabb3ee555
# Parent  bf00dda4a053a9dbf7163e993a454dd9dc03cb1f
templater: drop global exception catcher from runfilter() (API)

Now all built-in template filters declare input data types or handle type
errors by themselves.

.. api::

   Template filters should declare input data type and/or catch
   AttributeError, ValueError, TypeError, etc. as needed. See the doc of
   ``registrar.templatefilters`` for details.

diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py
--- a/mercurial/templateutil.py
+++ b/mercurial/templateutil.py
@@ -428,8 +428,6 @@ def runfilter(context, mapping, data):
     try:
         thing = unwrapastype(thing, getattr(filt, '_intype', None))
         return filt(thing)
-    except (ValueError, AttributeError, TypeError):
-        raise error.Abort(_formatfiltererror(arg, filt))
     except error.ParseError as e:
         raise error.ParseError(bytes(e), hint=_formatfiltererror(arg, filt))
 


More information about the Mercurial-devel mailing list