Skip to content

Add searchpath to TemplateNotFound exception message #1661

@tirkarthi

Description

@tirkarthi

This was from apache/airflow#23333 where trying to load a template that doesn't exist in the searchpath raises TemplateNotFound exception. In this case an absolute path is used which causes issue over concatenation but including searchpath might be a useful addition so that user can know under the paths under which the template was searched for and will be helpful during debugging.

raise TemplateNotFound(template)

Current exception :

jinja2.exceptions.TemplateNotFound: /tmp/a/python_template_exts.txt

Proposed exception to include searchpath :

jinja2.exceptions.TemplateNotFound: /tmp/a/python_template_exts.txt not found in search path ['/opt/airflow/tests/operators', '/']

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions