Skip to content

Commit

Permalink
Not returning the traceback on exception
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-oscarsson committed Dec 17, 2024
1 parent c269326 commit 6d35193
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions mxcubeweb/routes/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@ def unauth_handler():

@server.flask.before_request
def before_request():
# logging.getLogger("MX3.HWR").debug('Remote Addr: %s', request.remote_addr)
# logging.getLogger("MX3.HWR").debug('Path: %s', request.full_path)
# logging.getLogger("MX3.HWR").debug('scheme: %s', request.scheme)
# logging.getLogger("MX3.HWR").debug('Headers: %s', request.headers)

if not flask_login.current_user.is_anonymous:
flask_login.current_user.last_request_timestamp = datetime.now()
app.usermanager.update_user(flask_login.current_user)
Expand All @@ -77,7 +72,7 @@ def exceptions(e):
tb = traceback.format_exc()
timestamp = time.strftime("[%Y-%b-%d %H:%M]")
logging.getLogger("MX3.HWR").debug(
"%s %s %s %s %s 5xx INTERNAL SERVER ERROR\n%s",
"%s %s %s %s %s 501 INTERNAL SERVER ERROR\n%s",
timestamp,
request.remote_addr,
request.method,
Expand All @@ -86,6 +81,6 @@ def exceptions(e):
tb,
)

return tb
return jsonify("Server error"), 501

return bp

0 comments on commit 6d35193

Please sign in to comment.