Skip to content

Commit

Permalink
Print template path chain in TemplateNotFound exception
Browse files Browse the repository at this point in the history
  • Loading branch information
cmarqu authored and github-actions[bot] committed Jan 16, 2024
1 parent 80d5396 commit 061f6be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ Bugs fixed
Patch by James Addison.
* #11874: Configure a default 30-second value for ``linkcheck_timeout``.
Patch by James Addison.
* #11886: Print Jinja2 template path chain in ``TemplateNotFound`` exception.
Patch by Colin Marquardt.

Testing
-------
Expand Down
3 changes: 2 additions & 1 deletion sphinx/jinja2glue.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,5 @@ def get_source(self, environment: Environment, template: str) -> tuple[str, str,
return loader.get_source(environment, template)
except TemplateNotFound:
pass
raise TemplateNotFound(template)
exc_message = f"{template!r} not found in {self.environment.loader.pathchain}"
raise TemplateNotFound(exc_message)

0 comments on commit 061f6be

Please sign in to comment.