FileSystemLoader includes search paths in error

This commit is contained in:
Yourun-Proger 2022-05-02 15:42:19 +03:00 committed by David Lord
parent b4b28ec01c
commit ed5f76206a
No known key found for this signature in database
GPG Key ID: 43368A7AA8CC5926
2 changed files with 6 additions and 1 deletions

View File

@ -35,6 +35,8 @@ Unreleased
- Fix `copy`/`pickle` support for the internal ``missing`` object.
:issue:`2027`
- ``Environment.overlay(enable_async)`` is applied correctly. :pr:`2061`
- Paths where the loader searched for the template were added
to the error message. :issue:`1661`
Version 3.1.4

View File

@ -204,7 +204,10 @@ class FileSystemLoader(BaseLoader):
if os.path.isfile(filename):
break
else:
raise TemplateNotFound(template)
raise TemplateNotFound(
f"{template} not found in the following search path(s):"
f" {self.searchpath}"
)
with open(filename, encoding=self.encoding) as f:
contents = f.read()