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

login
register
mail settings
Submitter Yuya Nishihara
Date March 31, 2018, 1:49 a.m.
Message ID <9a2646947602dd11d7f6.1522460979@mimosa>
Download mbox | patch
Permalink /patch/30048/
State Accepted
Headers show

Comments

Yuya Nishihara - March 31, 2018, 1:49 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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.
Augie Fackler - March 31, 2018, 3:26 p.m.
On Sat, Mar 31, 2018 at 10:49:39AM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@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)

queued, thanks

Patch

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))