fix: invoke error page correctly

This commit is contained in:
Stefan Stammberger 2021-08-24 19:14:04 +02:00
parent 57fb6c4b11
commit de4d3b012c
No known key found for this signature in database
GPG Key ID: 645FA807E935D9D5

View File

@ -164,8 +164,6 @@ def register_async_tasks(app):
async def stop_listeners():
pass
templates = Jinja2Templates(directory="templates")
def register_exception_handlers(app):
@app.errorhandler(Exception)
async def basic_error(request: Request, err):
@ -173,4 +171,5 @@ def register_exception_handlers(app):
etype, value, tb = sys.exc_info()
traceback.print_exception(etype, err, tb)
exc = traceback.format_exc()
return await templates.TemplateResponse("templates/error.html", {"request": request, "err": err})
return g().templates.TemplateResponse("error.html", {"request": request, "err": err})