Krikri::PlusMinusOperandError
Inherits Krikri::UndefinedVariableError < Krikri::TemplatedOriginSpan < Exception < Reference < Object
The strict +/- operand failure: raised by ExpressionEvaluator's +/
- combining (combine_plus/combine_minus) and their operand resolver
(resolve_plus_operand, strict mode) when an operand is genuinely
undefined, a defined-null (None), the omit sentinel, or a container
on the wrong side of a concatenation - every class Ansible's
own templating hard-fails the task on (live-verified against 2.19.11:
unsupported operand type(s) for +: 'NoneType' and 'str',
can only concatenate list (not "int") to list, 'missing_var' is undefined, _OmitType operand). Subclasses UndefinedVariableError so
every existing rescue site that treats a strict-undefined as a task
failure handles it unchanged - it IS a strict-templating failure, just
the operand-type branch of it, and it lets the +/- strictness check
re-raise its OWN verdict through the conservative validation gate
(which swallows every OTHER internal raise as "cannot validate").
Class methods
A +/- between mismatched operand types can also surface from
krikri-jinja's own evaluator (its "unsupported operands for +: Nil
and Int64" TemplateError) when the expression falls through to the
engine - e.g. the + sits inside a dict literal handed to a filter
(sansible.aws_volume's tags: "{{ ... | combine({...}) }}"). Real
ansible-core 2.19.11 words that failure in Python's TypeError shape,
so translate the engine's raw message onto a PlusMinusOperandError
when the shape is recognized; nil leaves the engine's own wording
alone rather than guessing (string/list concatenation uses a
different Python message that is not verified here).
Instance methods
Real ansible-core 2.19.11 wraps an operator TypeError ("unsupported operand type(s) for +: 'NoneType' and 'str'", "can only concatenate str (not "NoneType") to str", "bad operand type for unary -") as "Error rendering template: <msg>" everywhere it surfaces, but leaves a genuinely undefined NAME bare ("'x' is undefined"). The same class carries both shapes, so the display sites ask this instead of guessing from the call path.