diff --git a/tests/unit/test_workflows.py b/tests/unit/test_workflows.py index cbcd1017a..c54b97295 100644 --- a/tests/unit/test_workflows.py +++ b/tests/unit/test_workflows.py @@ -1606,7 +1606,7 @@ async def test_pull_based_workflow_fetches_latest_version(temporal_client, test_ # f"Function: {run_action_on_ray_cluster.__name__}\n" # f"Line: {run_action_on_ray_cluster.__code__.co_firstlineno}" ), - "type": "ActionExecutionError", + "type": "ExecutorClientError", "expr_context": "ACTIONS", "attempt": 1, } diff --git a/tracecat/dsl/action.py b/tracecat/dsl/action.py index f0979d93d..e7db36231 100644 --- a/tracecat/dsl/action.py +++ b/tracecat/dsl/action.py @@ -15,7 +15,7 @@ from tracecat.logger import logger from tracecat.registry.actions.models import RegistryActionValidateResponse from tracecat.types.auth import Role -from tracecat.types.exceptions import ActionExecutionError +from tracecat.types.exceptions import ExecutorClientError def contextualize_message( @@ -106,8 +106,8 @@ async def run_action_activity(input: RunActionInput, role: Role) -> Any: # Delegate to the registry client client = ExecutorClient(role=role) return await client.run_action_memory_backend(input) - except ActionExecutionError as e: - # We only expect ActionExecutionError to be raised from the executor client + except ExecutorClientError as e: + # We only expect ExecutorClientError to be raised from the executor client kind = e.__class__.__name__ msg = str(e) err_locator = contextualize_message(task, msg, attempt=attempt) diff --git a/tracecat/executor/client.py b/tracecat/executor/client.py index c3fb43eac..afb88d304 100644 --- a/tracecat/executor/client.py +++ b/tracecat/executor/client.py @@ -25,7 +25,7 @@ RegistryActionValidateResponse, ) from tracecat.types.auth import Role -from tracecat.types.exceptions import ActionExecutionError, RegistryError +from tracecat.types.exceptions import ExecutorClientError, RegistryError class ExecutorHTTPClient(AuthenticatedServiceClient): @@ -79,15 +79,15 @@ async def run_action_memory_backend(self, input: RunActionInput) -> Any: except httpx.HTTPStatusError as e: self._handle_http_status_error(e, action_type) except httpx.ReadTimeout as e: - raise ActionExecutionError( + raise ExecutorClientError( f"Timeout calling action {action_type!r} in executor: {e}" ) from e except orjson.JSONDecodeError as e: - raise ActionExecutionError( + raise ExecutorClientError( f"Error decoding JSON response for action {action_type!r}: {e}" ) from e except Exception as e: - raise ActionExecutionError( + raise ExecutorClientError( f"Unexpected error calling action {action_type!r} in executor: {e}" ) from e @@ -197,10 +197,10 @@ def _handle_http_status_error( detail = e.response.text self.logger.error("Executor returned an error", error=e, detail=detail) if e.response.status_code / 100 == 5: - raise ActionExecutionError( + raise ExecutorClientError( f"There was an error in the executor when calling action {action_type!r} ({e.response.status_code}).\n\n{detail}" ) from e else: - raise ActionExecutionError( + raise ExecutorClientError( f"Unexpected executor error ({e.response.status_code}):\n\n{e}\n\n{detail}" ) from e diff --git a/tracecat/types/exceptions.py b/tracecat/types/exceptions.py index 27a5cd0c3..20edb3691 100644 --- a/tracecat/types/exceptions.py +++ b/tracecat/types/exceptions.py @@ -82,8 +82,8 @@ class TaskUnreachable(TracecatException): """Raised when a task is unreachable.""" -class ActionExecutionError(TracecatException): - """Exception raised when an action execution error occurs.""" +class ExecutorClientError(TracecatException): + """Exception raised when an error occurs in the executor client.""" class WrappedExecutionError(TracecatException):