# HG changeset patch # User Ryan McElroy # Date 2014-06-13 01:07:21 # Node ID 028a481051919e3c985261ac62606704435f9c6a # Parent 4a445dc5abff7f0e971222bea1bf04ce02bead5e templater: add symbol to error This patch makes it easier to debug writing templater functions by telling the user exactly what was sent to the templater. diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -111,7 +111,7 @@ def compileexp(exp, context): def getsymbol(exp): if exp[0] == 'symbol': return exp[1] - raise error.ParseError(_("expected a symbol")) + raise error.ParseError(_("expected a symbol, got '%s'") % exp[0]) def getlist(x): if not x: diff --git a/tests/test-command-template.t b/tests/test-command-template.t --- a/tests/test-command-template.t +++ b/tests/test-command-template.t @@ -1911,3 +1911,9 @@ Test startswith | o line 1 line 2 + +Test bad template with better error message + + $ hg log -Gv -R a --template '{desc|user()}' + hg: parse error: expected a symbol, got 'func' + [255]