Mercurial > hg-stable
changeset 37232:63144f33c8bb
templatefilters: raise ProgrammingError if unencodable type passed to json()
This shouldn't happen for any template data types (though I know it does
because of some templater bugs.) Let's clarify it is a bug.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 18 Mar 2018 16:53:08 +0900 |
parents | 05db42732fce |
children | dc4bb1422f2b |
files | mercurial/templatefilters.py |
diffstat | 1 files changed, 1 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/templatefilters.py Sun Mar 18 16:47:44 2018 +0900 +++ b/mercurial/templatefilters.py Sun Mar 18 16:53:08 2018 +0900 @@ -263,8 +263,7 @@ elif util.safehasattr(obj, '__iter__'): out = [json(i, paranoid) for i in obj] return '[' + ', '.join(out) + ']' - else: - raise TypeError('cannot encode type %s' % obj.__class__.__name__) + raise error.ProgrammingError('cannot encode %r' % obj) @templatefilter('lower', intype=bytes) def lower(text):