Two cases are handled:
1. pop on the stack when there is nothing to pop. Error (wrapped for reading) looks like:
There was an error searching issue by status using: [-2, 3, 4, -4].
The operator -2 (not) at position 1 has too few arguments.
a second case with two errors (-4 has too few arguments too) reports only
the first error:
There was an error searching issue by status using: [-2, 4, -4]. The operator
-2 (not) at position 1 has too few arguments.
where the terms "issue", "status", "[-2, 4, -4]" '-2 (not)' and position number (1)
are all supplied from a context attribute on the new ExpressionError exception.
2. The stack has more than one item on it when returning. Error looks like:
Error when searching issue by status using: [-1, 6, 1, 2, -4]. There are too many
arguments for the existing operators. The values on the stack are: [ISEMPTY(-1),
Value 6, (Value 1 OR Value 2)]
where "issue", "status", "[-1, 6, 1, 2, -4]", and "[ISEMPTY(-1), Value 6,
(Value 1 OR Value 2)]" are supplied by the context property on the
ExpressionError exception.
The ExpressionError exception is called like:
raise ExpressionError(
"There was an error searching %(class)s by %(attr)s using: %(opcodes)s. "
"The operator %(opcode)s (%(opcodename)s) at position "
"%(position)d has too few arguments.",
context={
"opcode": opcode,
"opcodename": opcode_names[opcode],
"position": position + 1,
"opcodes": opcodes,
})
it's __repr__ and __str__ methods use args[0] as a % print template with context as the
dict. If using % fails, and alternate output format is used. The context argument is
added to by callers of the Expression class since the class and attribute being searched
is only available to the callers.
Replaced NOtestFilteringLinkInvalid with testFilteringBrokenMultilinkExpression and
testFilteringBrokenLinkExpression. Also a test was added to test_liveserver.
Note that the error displayed on the web isn't very nice. It falls back to a basic error
page with no frame or other components. It would be better if we could display an empty
index page with an error message at the top. Handling a nice display is still to be done.
Even with this poor UI, it does help identify issues when I make a mistake with a filter
expression.
changeset: 8241:741ea8a86012 |