Commit f6744d3e authored by Marcus Andersson's avatar Marcus Andersson Committed by Kevin Morris
Browse files

Adding error 503 catcher

parent cdf75ced
......@@ -8,12 +8,12 @@ from starlette.middleware.sessions import SessionMiddleware
import aurweb.config
from aurweb.db import get_engine
from aurweb.routers import html, sso
from aurweb.routers import html, sso, errors
routes = set()
# Setup the FastAPI app.
app = FastAPI()
app = FastAPI(exception_handlers=errors.exceptions)
@app.on_event("startup")
......
......@@ -8,7 +8,13 @@ async def not_found(request, exc):
return render_template("errors/404.html", context)
async def service_unavailable(request, exc):
_ = l10n.get_translator_for_request(request)
context = make_context(request, "503 - {_('Service Unavailable')}")
return render_template("errors/503.html", context)
# Maps HTTP errors to functions
exceptions = {
404: not_found,
503: service_unavailable
}
{% extends 'partials/layout.html' %}
{% block pageContent %}
<div class="box 404">
<h2>503 - {% trans %}Service Unavailable{% endtrans %}</h2>
<p>{% trans %}Don't panic! This site is down due to maintenance. We will be back soon.{% endtrans %}</p>
</div>
{% endblock %}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment