Print template path chain in TemplateNotFound exceptions (#11886)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
This commit is contained in:
Colin Marquardt 2024-01-16 21:17:34 +01:00 committed by GitHub
parent 80d5396f9d
commit 9c59a6ea84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -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
-------

View File

@ -218,4 +218,5 @@ class BuiltinTemplateLoader(TemplateBridge, BaseLoader):
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)