We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 090b96d commit fd57a62Copy full SHA for fd57a62
1 file changed
polling/test_service.py
@@ -2,6 +2,7 @@
2
from typing import Counter
3
4
from temporalio import activity
5
+from temporalio.exceptions import ApplicationError, ApplicationErrorCategory
6
7
attempts = Counter[str]()
8
ERROR_ATTEMPTS = 5
@@ -20,4 +21,10 @@ async def get_service_result(input):
20
21
print(f"Attempt {attempts[workflow_id]} of {ERROR_ATTEMPTS} to invoke service")
22
if attempts[workflow_id] == ERROR_ATTEMPTS:
23
return f"{input.greeting}, {input.name}!"
- raise Exception("service is down")
24
+ raise ApplicationError(
25
+ message="service is down",
26
+ # Set the error as BENIGN to indicate it is an expected error.
27
+ # BENIGN errors have activity failure logs downgraded to DEBUG level
28
+ # and do not emit activity failure metrics.
29
+ category=ApplicationErrorCategory.BENIGN,
30
+ )
0 commit comments