Skip to content

Commit

Permalink
Only put relevant function call in try-except block
Browse files Browse the repository at this point in the history
  • Loading branch information
heyman authored Apr 8, 2020
1 parent 15ea44c commit d744e75
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions locust/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,14 @@ def timelimit_stop():
# start Web UI
if not options.headless and not options.worker:
# spawn web greenlet
logger.info("Starting web monitor at http://%s:%s" % (options.web_host or "*", options.web_port))
try:
logger.info("Starting web monitor at http://%s:%s" % (options.web_host or "*", options.web_port))
web_ui = WebUI(environment=environment, auth_credentials=options.web_auth)
main_greenlet = gevent.spawn(web_ui.start, host=options.web_host, port=options.web_port)
except AuthCredentialsError:
logger.error("Credentials in --web-auth need to be in the format username:password")
logger.error("Credentials supplied with --web-auth should have the format: username:password")
sys.exit(1)
else:
main_greenlet = gevent.spawn(web_ui.start, host=options.web_host, port=options.web_port)
else:
web_ui = None

Expand Down

0 comments on commit d744e75

Please sign in to comment.