File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -250,8 +250,16 @@ def refresh_token(self):
250250 response = self .client .post ('oauth/token' , data )
251251 self .refresh_attempts = 0
252252 except (OAuthException , BadRequestException ) as e :
253- error = e .response .json ().get ("error" ) if e .response is not None else "No error description"
254- error_description = e .response .json ().get ("error_description" ) if e .response is not None else ""
253+ if e .response is not None :
254+ try :
255+ error = e .response .json ().get ("error" )
256+ error_description = e .response .json ().get ("error_description" )
257+ except JSONDecodeError :
258+ error = "Invalid JSON response"
259+ error_description = e .response .text
260+ else :
261+ error = "No error description"
262+ error_description = ""
255263 self .logger .error (
256264 "%s - Unable to refresh expired OAuth token (%s) %s" ,
257265 e .http_code , error , error_description
You can’t perform that action at this time.
0 commit comments