##// END OF EJS Templates
templater: attach hint to input-type error of runfilter()...
Yuya Nishihara -
r37243:920589f5 default
parent child Browse files
Show More
@@ -423,14 +423,17 b' def runfilter(context, mapping, data):'
423 423 thing = unwrapastype(thing, getattr(filt, '_intype', None))
424 424 return filt(thing)
425 425 except (ValueError, AttributeError, TypeError):
426 sym = findsymbolicname(arg)
427 if sym:
428 msg = (_("template filter '%s' is not compatible with keyword '%s'")
429 % (pycompat.sysbytes(filt.__name__), sym))
430 else:
431 msg = (_("incompatible use of template filter '%s'")
432 % pycompat.sysbytes(filt.__name__))
433 raise error.Abort(msg)
426 raise error.Abort(_formatfiltererror(arg, filt))
427 except error.ParseError as e:
428 raise error.ParseError(bytes(e), hint=_formatfiltererror(arg, filt))
429
430 def _formatfiltererror(arg, filt):
431 fn = pycompat.sysbytes(filt.__name__)
432 sym = findsymbolicname(arg)
433 if not sym:
434 return _("incompatible use of template filter '%s'") % fn
435 return (_("template filter '%s' is not compatible with keyword '%s'")
436 % (fn, sym))
434 437
435 438 def runmap(context, mapping, data):
436 439 darg, targ = data
General Comments 0
You need to be logged in to leave comments. Login now