Skip to content

Commit

Permalink
Print template path chain in TemplateNotFound exceptions (#11886)
Browse files Browse the repository at this point in the history
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
  • Loading branch information
cmarqu and AA-Turner committed Jan 16, 2024
1 parent 80d5396 commit 9c59a6e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.rst
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 the Jinja2 template path chain in ``TemplateNotFound`` exceptions.
Patch by Colin Marquardt.

Testing
-------
Expand Down
3 changes: 2 additions & 1 deletion sphinx/jinja2glue.py
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)
msg = f"{template!r} not found in {self.environment.loader.pathchain}"
raise TemplateNotFound(msg)

0 comments on commit 9c59a6e

Please sign in to comment.