Skip to content

Commit

Permalink
Add logging for uncaught exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Baldwin committed Nov 1, 2023
1 parent 0feee77 commit a6e471e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions locust/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ def __init__(
if not delayed_start:
self.start()

@app.errorhandler(Exception)
def handle_exception(error):
error_message = str(error)
logger.log(logging.CRITICAL, error_message)
return make_response(error_message, 500)

@app.route("/assets/<path:path>")
def send_assets(path):
webui_build_path = self.webui_build_path
Expand Down

0 comments on commit a6e471e

Please sign in to comment.