Skip to content
This repository was archived by the owner on Apr 12, 2018. It is now read-only.

Commit e26905c

Browse files
author
Oleiade
committed
Enhance worker actor polling error handling
1 parent 87de1fc commit e26905c

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

swf/actors/worker.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,17 @@ def poll(self, task_list=None, identity=None):
115115
task_list = task_list or self.task_list
116116
identity = identity or self.identity
117117

118-
polled_activity_data = self.connection.poll_for_activity_task(
119-
self.domain.name,
120-
task_list,
121-
identity=identity
122-
)
118+
try:
119+
polled_activity_data = self.connection.poll_for_activity_task(
120+
self.domain.name,
121+
task_list,
122+
identity=identity
123+
)
124+
except SWFResponseError as e:
125+
if e.error_code == 'UnknownResourceFault':
126+
raise DoesNotExistError("Canno't poll activity task of a closed workflow execution")
127+
128+
raise ResponseError(e.body['message'])
123129

124130
if not 'taskToken' in polled_activity_data:
125131
raise PollTimeout("Activity Worker poll timed out")

0 commit comments

Comments
 (0)