File tree Expand file tree Collapse file tree 3 files changed +7
-3
lines changed
Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ def handle_response(self, r):
5454 try :
5555 return r .json ()
5656 except simplejson .errors .JSONDecodeError as e :
57- raise ApiError ({ 'message' : 'Conversion in progress' })
57+ raise AsyncConversionInProgress
5858
5959 def url (self , path ):
6060 return "%s%s?Secret=%s" % (convertapi .base_uri , path , convertapi .api_secret )
Original file line number Diff line number Diff line change @@ -13,3 +13,7 @@ def __init__(self, result):
1313 def __str__ (self ):
1414 message = "%s Code: %s. %s" % (self .message , self .code , self .invalid_parameters )
1515 return message .strip ()
16+
17+
18+ class AsyncConversionInProgress (BaseError ):
19+ pass
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ def test_polling_too_fast_and_getting_202_accepted(self):
105105 convert_result = convertapi .async_convert ('pdf' , { 'File' : 'examples/files/test.docx' })
106106 try :
107107 convertapi .async_poll (convert_result .response ['JobId' ])
108- except convertapi .ApiError :
108+ except convertapi .AsyncConversionInProgress :
109109 pass
110110 else :
111111 raise AssertionError
@@ -116,7 +116,7 @@ def test_polling_too_fast_and_getting_202_accepted(self):
116116def get_poll_result (job_id , retry_count = 5 ):
117117 try :
118118 result = convertapi .async_poll (job_id )
119- except convertapi .ApiError :
119+ except convertapi .AsyncConversionInProgress :
120120 if retry_count > 0 :
121121 time .sleep ((1 + 0.1 ) ** (5 - retry_count ) - 1 )
122122 return get_poll_result (job_id , retry_count = retry_count - 1 )
You can’t perform that action at this time.
0 commit comments