Skip to content

Commit

Permalink
Better message for exception for templated base operator fields
Browse files Browse the repository at this point in the history
  • Loading branch information
RNHTTR committed Feb 23, 2024
1 parent f8b947e commit 3d2d6ea
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion airflow/serialization/serialized_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,10 @@ def _serialize_node(cls, op: BaseOperator | MappedOperator, include_deps: bool)
if op.template_fields:
for template_field in op.template_fields:
if template_field in forbidden_fields:
raise AirflowException(f"Cannot template BaseOperator fields: {template_field}")
raise AirflowException(
f"""Cannot template BaseOperator field:
{template_field!r} {op.__class__.__name__=} {op.template_fields=}"""
)
value = getattr(op, template_field, None)
if not cls._is_excluded(value, template_field, op):
serialize_op[template_field] = serialize_template_field(value)
Expand Down

0 comments on commit 3d2d6ea

Please sign in to comment.