File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -76,19 +76,23 @@ def _make_request(
7676
7777
7878async def _send_request (request : HTTPRequest ) -> HTTPResponse :
79- response = await AsyncHTTPClient ().fetch (request , raise_error = False )
79+ try :
80+ # The raise_error=False argument only affects the HTTPError raised when a non-200 response
81+ # code is used, instead of suppressing all errors.
82+ response = await AsyncHTTPClient ().fetch (request , raise_error = False )
83+
84+ if response .code != 200 :
8085
81- if response .code != 200 :
82- try :
8386 decoded = json .loads (response .body )
8487 if decoded ['error' ] == 'unauthorized' :
8588 response .error = Exception ('Authentication Error' )
8689
8790 elif decoded ['error' ]:
8891 response .error = Exception (decoded ['error' ])
89-
90- except Exception as e :
91- logging .error (f"_send_request: { e } " )
92+ except Exception as e :
93+ logging .error (f"_send_request: { e } " )
94+ response = HTTPResponse (request , 599 )
95+ response .error = e
9296
9397 return response
9498
You can’t perform that action at this time.
0 commit comments