Custom 500 and thread bugfix
This commit is contained in:
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(
|
||||
|
Reference in New Issue
Block a user