diff --git a/qutebrowser/utils/jinja.py b/qutebrowser/utils/jinja.py index e60032ff4..f2dbbfe5f 100644 --- a/qutebrowser/utils/jinja.py +++ b/qutebrowser/utils/jinja.py @@ -31,6 +31,49 @@ from qutebrowser.utils import utils, urlutils, log from PyQt5.QtCore import QUrl +html_fallback = ''' + + + + {{ title }} + {% if icon %} + + {% endif %} + + + +
+ + + + + +
+ + +

The error.html template could not be found!
Please check your qutebrowser installation

''' +html_fallback2 = '''

+

Unable to load page

+ Error while opening {{ url }}:
+

{{ error }}



+ +
+ +
+ +
+
+ + +''' class Loader(jinja2.BaseLoader): @@ -47,8 +90,8 @@ class Loader(jinja2.BaseLoader): path = os.path.join(self._subdir, template) try: source = utils.read_file(path) - except OSError: - raise jinja2.TemplateNotFound(template) + except OSError as e: + source = html_fallback + str(e) + html_fallback2; # Currently we don't implement auto-reloading, so we always return True # for up-to-date. return source, path, lambda: True