Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion polling/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import Counter

from temporalio import activity
from temporalio.exceptions import ApplicationError, ApplicationErrorCategory

attempts = Counter[str]()
ERROR_ATTEMPTS = 5
Expand All @@ -20,4 +21,10 @@ async def get_service_result(input):
print(f"Attempt {attempts[workflow_id]} of {ERROR_ATTEMPTS} to invoke service")
if attempts[workflow_id] == ERROR_ATTEMPTS:
return f"{input.greeting}, {input.name}!"
raise Exception("service is down")
raise ApplicationError(
message="service is down",
# Set the error as BENIGN to indicate it is an expected error.
# BENIGN errors have activity failure logs downgraded to DEBUG level
# and do not emit activity failure metrics.
category=ApplicationErrorCategory.BENIGN,
)
Loading