From a557275112dd6d5b5a9fffdd0003b43f5db049d2 Mon Sep 17 00:00:00 2001 From: Lorenze Jay Date: Fri, 14 Feb 2025 09:10:56 -0800 Subject: [PATCH] Propagate method execution failures in Flow class - Modify Flow class to re-raise exceptions after emitting MethodExecutionFailedEvent - Reorder MethodExecutionFailedEvent import to maintain consistent import style --- src/crewai/flow/flow.py | 1 + src/crewai/utilities/events/event_types.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/crewai/flow/flow.py b/src/crewai/flow/flow.py index ac89fa088..873987c07 100644 --- a/src/crewai/flow/flow.py +++ b/src/crewai/flow/flow.py @@ -856,6 +856,7 @@ class Flow(Generic[T], metaclass=FlowMeta): error=e, ), ) + raise e async def _execute_listeners(self, trigger_method: str, result: Any) -> None: """ diff --git a/src/crewai/utilities/events/event_types.py b/src/crewai/utilities/events/event_types.py index 774dc8b0e..5beef2ff3 100644 --- a/src/crewai/utilities/events/event_types.py +++ b/src/crewai/utilities/events/event_types.py @@ -19,9 +19,9 @@ from .crew_events import ( from .flow_events import ( FlowFinishedEvent, FlowStartedEvent, + MethodExecutionFailedEvent, MethodExecutionFinishedEvent, MethodExecutionStartedEvent, - MethodExecutionFailedEvent, ) from .task_events import ( TaskCompletedEvent,