diff --git a/atst/routes/__init__.py b/atst/routes/__init__.py index 0149ace5..780ff0c3 100644 --- a/atst/routes/__init__.py +++ b/atst/routes/__init__.py @@ -2,6 +2,7 @@ import urllib.parse as url from flask import Blueprint, render_template, g, redirect, session, url_for, request from flask import current_app as app +from jinja2.exceptions import TemplateNotFound import pendulum import os @@ -10,6 +11,7 @@ from atst.domain.users import Users from atst.domain.authnid import AuthenticationContext from atst.domain.audit_log import AuditLog from atst.domain.auth import logout as _logout +from werkzeug.exceptions import NotFound bp = Blueprint("atst", __name__) @@ -77,7 +79,10 @@ def styleguide(): @bp.route("/") def catch_all(path): - return render_template("{}.html".format(path)) + try: + return render_template("{}.html".format(path)) + except TemplateNotFound: + raise NotFound() def _make_authentication_context(): diff --git a/templates/error.html b/templates/error.html index c8714c01..f58eac86 100644 --- a/templates/error.html +++ b/templates/error.html @@ -10,6 +10,10 @@

An error occurred.

{% endif %} +{% if g.current_user %} +

Return home.

+{% endif %} + {% endblock %}