Custom 500 and thread bugfix
This commit is contained in:
parent
0fa6159c47
commit
efc59f7e07
8 changed files with 16 additions and 8 deletions
13
app.py
13
app.py
|
@ -1,4 +1,5 @@
|
|||
import json
|
||||
from werkzeug.exceptions import InternalServerError
|
||||
import logging
|
||||
import os
|
||||
import traceback
|
||||
|
@ -214,6 +215,18 @@ def handle_task_error(error):
|
|||
return response
|
||||
|
||||
|
||||
@app.errorhandler(InternalServerError)
|
||||
def handle_500(e):
|
||||
tb = "".join(traceback.format_tb(e.__traceback__))
|
||||
logger.error(f"caught error {e!r}, {tb}")
|
||||
if not session.get("logged_in", False):
|
||||
tb = None
|
||||
|
||||
return render_template(
|
||||
"error.html", code=500, status_text="Internal Server Error", tb=tb
|
||||
)
|
||||
|
||||
|
||||
# @app.errorhandler(Exception)
|
||||
# def handle_other_error(error):
|
||||
# logger.error(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue