mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Adding error 404 catcher
This commit is contained in:
parent
82f3871a83
commit
cdf75ced9a
2 changed files with 22 additions and 0 deletions
14
aurweb/routers/errors.py
Normal file
14
aurweb/routers/errors.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
from aurweb.templates import make_context, render_template
|
||||
from aurweb import l10n
|
||||
|
||||
|
||||
async def not_found(request, exc):
|
||||
_ = l10n.get_translator_for_request(request)
|
||||
context = make_context(request, f"404 - {_('Page Not Found')}")
|
||||
return render_template("errors/404.html", context)
|
||||
|
||||
|
||||
# Maps HTTP errors to functions
|
||||
exceptions = {
|
||||
404: not_found,
|
||||
}
|
8
templates/errors/404.html
Normal file
8
templates/errors/404.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
{% extends 'partials/layout.html' %}
|
||||
|
||||
{% block pageContent %}
|
||||
<div class="box 404">
|
||||
<h2>404 - {% trans %}Page Not Found{% endtrans %}</h2>
|
||||
<p>{% trans %}Sorry, the page you've requested does not exist.{% endtrans %}</p>
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Add table
Reference in a new issue