1
1
#! -*- coding:utf-8 -*-
2
2
3
+ import boto .exception
3
4
from swf .actors import Actor
4
5
from swf .models import ActivityTask
5
- from swf .exceptions import PollTimeout
6
+ from swf .exceptions import PollTimeout , ResponseError , DoesNotExistError
6
7
7
8
8
9
class ActivityWorker (Actor ):
@@ -44,7 +45,7 @@ def cancel(self, task_token, details=None):
44
45
"""
45
46
try :
46
47
return self .connection .respond_activity_task_canceled (task_token )
47
- except SWFResponseError as e :
48
+ except boto . exception . SWFResponseError as e :
48
49
if e .error_code == 'UnknownResourceFault' :
49
50
raise DoesNotExistError (
50
51
"Unable to cancel activity task with token: {}.\n " .format (task_token ),
@@ -67,7 +68,7 @@ def complete(self, task_token, result=None):
67
68
task_token ,
68
69
result
69
70
)
70
- except SWFResponseError as e :
71
+ except boto . exception . SWFResponseError as e :
71
72
if e .error_code == 'UnknownResourceFault' :
72
73
raise DoesNotExistError (
73
74
"Unable to complete activity task with token: {}.\n " .format (task_token ),
@@ -94,7 +95,7 @@ def fail(self, task_token, details=None, reason=None):
94
95
details ,
95
96
reason
96
97
)
97
- except SWFResponseError as e :
98
+ except boto . exception . SWFResponseError as e :
98
99
if e .error_code == 'UnknownResourceFault' :
99
100
raise DoesNotExistError (
100
101
"Unable to fail activity task with token: {}.\n " .format (task_token ),
@@ -117,7 +118,7 @@ def heartbeat(self, task_token, details=None):
117
118
task_token ,
118
119
details
119
120
)
120
- except SWFResponseError as e :
121
+ except boto . exception . SWFResponseError as e :
121
122
if e .error_code == 'UnknownResourceFault' :
122
123
raise DoesNotExistError (
123
124
"Unable to send activity task {} heartbeat.\n " .format (task_token ),
@@ -157,7 +158,7 @@ def poll(self, task_list=None, identity=None):
157
158
task_list ,
158
159
identity = identity
159
160
)
160
- except SWFResponseError as e :
161
+ except boto . exception . SWFResponseError as e :
161
162
if e .error_code == 'UnknownResourceFault' :
162
163
raise DoesNotExistError (
163
164
"Unable to poll activity task.\n " ,
0 commit comments