Show More
@@ -146,7 +146,15 b' def buildfilter(exp, context):' | |||||
146 |
|
146 | |||
147 | def runfilter(context, mapping, data): |
|
147 | def runfilter(context, mapping, data): | |
148 | func, data, filt = data |
|
148 | func, data, filt = data | |
149 | return filt(func(context, mapping, data)) |
|
149 | try: | |
|
150 | return filt(func(context, mapping, data)) | |||
|
151 | except (ValueError, AttributeError, TypeError): | |||
|
152 | if isinstance(data, tuple): | |||
|
153 | dt = data[1] | |||
|
154 | else: | |||
|
155 | dt = data | |||
|
156 | raise util.Abort(_("template filter '%s' is not compatible with " | |||
|
157 | "keyword '%s'") % (filt.func_name, dt)) | |||
150 |
|
158 | |||
151 | def buildmap(exp, context): |
|
159 | def buildmap(exp, context): | |
152 | func, data = compileexp(exp[1], context) |
|
160 | func, data = compileexp(exp[1], context) |
@@ -1255,6 +1255,30 b' Error on syntax:' | |||||
1255 | abort: t:3: unmatched quotes |
|
1255 | abort: t:3: unmatched quotes | |
1256 | [255] |
|
1256 | [255] | |
1257 |
|
1257 | |||
|
1258 | Behind the scenes, this will throw TypeError | |||
|
1259 | ||||
|
1260 | $ hg log -l 3 --template '{date|obfuscate}\n' | |||
|
1261 | abort: Template filter 'obfuscate' is not compatible with keyword 'date' | |||
|
1262 | [255] | |||
|
1263 | ||||
|
1264 | Behind the scenes, this will throw a ValueError | |||
|
1265 | ||||
|
1266 | $ hg log -l 3 --template 'line: {desc|shortdate}\n' | |||
|
1267 | abort: Template filter 'shortdate' is not compatible with keyword 'desc' | |||
|
1268 | [255] | |||
|
1269 | ||||
|
1270 | Behind the scenes, this will throw AttributeError | |||
|
1271 | ||||
|
1272 | $ hg log -l 3 --template 'line: {date|escape}\n' | |||
|
1273 | abort: Template filter 'escape' is not compatible with keyword 'date' | |||
|
1274 | [255] | |||
|
1275 | ||||
|
1276 | Behind the scenes, this will throw ValueError | |||
|
1277 | ||||
|
1278 | $ hg tip --template '{author|email|date}\n' | |||
|
1279 | abort: Template filter 'datefilter' is not compatible with keyword 'author' | |||
|
1280 | [255] | |||
|
1281 | ||||
1258 | $ cd .. |
|
1282 | $ cd .. | |
1259 |
|
1283 | |||
1260 |
|
1284 |
General Comments 0
You need to be logged in to leave comments.
Login now