Skip to content

Commit

Permalink
fix(agents-api): temporal error exceptions caught
Browse files Browse the repository at this point in the history
  • Loading branch information
Vedantsahai18 committed Oct 16, 2024
1 parent d1b37d3 commit a1d444f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions agents-api/agents_api/common/interceptors.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
certain types of errors that are known to be non-retryable.
"""

from temporalio.workflow import ContinueAsNewError, ReadOnlyContextError, NondeterminismError
from temporalio.service import RPCError
from temporalio.exceptions import TemporalError, FailureError
from typing import Optional, Type

from temporalio.exceptions import ApplicationError
Expand Down Expand Up @@ -31,6 +34,8 @@ class CustomActivityInterceptor(ActivityInboundInterceptor):
async def execute_activity(self, input: ExecuteActivityInput):
try:
return await super().execute_activity(input)
except (ContinueAsNewError, ReadOnlyContextError, NondeterminismError, RPCError, TemporalError, FailureError):
raise
except BaseException as e:
if is_non_retryable_error(e):
raise ApplicationError(
Expand All @@ -53,6 +58,8 @@ class CustomWorkflowInterceptor(WorkflowInboundInterceptor):
async def execute_workflow(self, input: ExecuteWorkflowInput):
try:
return await super().execute_workflow(input)
except (ContinueAsNewError, ReadOnlyContextError, NondeterminismError, RPCError, TemporalError, FailureError):
raise
except BaseException as e:
if is_non_retryable_error(e):
raise ApplicationError(
Expand Down

0 comments on commit a1d444f

Please sign in to comment.