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,
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue