##// 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 thing = unwrapastype(thing, getattr(filt, '_intype', None))
423 thing = unwrapastype(thing, getattr(filt, '_intype', None))
424 return filt(thing)
424 return filt(thing)
425 except (ValueError, AttributeError, TypeError):
425 except (ValueError, AttributeError, TypeError):
426 sym = findsymbolicname(arg)
426 raise error.Abort(_formatfiltererror(arg, filt))
427 if sym:
427 except error.ParseError as e:
428 msg = (_("template filter '%s' is not compatible with keyword '%s'")
428 raise error.ParseError(bytes(e), hint=_formatfiltererror(arg, filt))
429 % (pycompat.sysbytes(filt.__name__), sym))
429
430 else:
430 def _formatfiltererror(arg, filt):
431 msg = (_("incompatible use of template filter '%s'")
431 fn = pycompat.sysbytes(filt.__name__)
432 % pycompat.sysbytes(filt.__name__))
432 sym = findsymbolicname(arg)
433 raise error.Abort(msg)
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 def runmap(context, mapping, data):
438 def runmap(context, mapping, data):
436 darg, targ = data
439 darg, targ = data
General Comments 0
You need to be logged in to leave comments. Login now