Skip to content

Commit

Permalink
PR #1462 introduced a small bug, where exceptions intentionally raise…
Browse files Browse the repository at this point in the history
…d in event handlers would also be caught. Re-raise those exceptions.
  • Loading branch information
cyberw committed Aug 6, 2020
1 parent 2f8e64e commit a548031
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion locust/event.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
from . import log
import traceback
from .exception import StopUser, RescheduleTask, RescheduleTaskImmediately, InterruptTaskSet

class EventHook(object):
"""
Expand Down Expand Up @@ -36,7 +37,11 @@ def fire(self, *, reverse=False, **kwargs):
for handler in handlers:
try:
handler(**kwargs)
except Exception as e:
except (StopUser, RescheduleTask, RescheduleTaskImmediately, InterruptTaskSet):
# These exceptions could be thrown by, for example, a request_failure handler,
# in which case they are entirely appropriate and should not be caught
raise
except Exception:
logging.error("Uncaught exception in event handler: \n%s", traceback.format_exc())
log.unhandled_greenlet_exception = True

Expand Down

0 comments on commit a548031

Please sign in to comment.