mirror of
https://github.com/norohind/FDEV-CAPI-Handler.git
synced 2026-10-22 23:12:11 +03:00
Don't drop tokens if refresh failed due to a connection issue
This commit is contained in:
1 file changed
+9
-1
+9
-1
@@ -1,3 +1,5 @@
|
||||
import requests
|
||||
|
||||
from . import model
|
||||
from . import utils
|
||||
from . import exceptions
|
||||
@@ -146,9 +148,15 @@ class CAPIAuthorizer:
|
||||
msg['description'] = 'Token were successfully updated'
|
||||
return msg
|
||||
|
||||
except requests.ConnectionError as e:
|
||||
logger.warning(f'Connection problem on refresh for {state!r}', exc_info=e)
|
||||
msg['status'] = 'error'
|
||||
msg['description'] = 'Connection Error'
|
||||
raise exceptions.RefreshFail(msg['description'], msg['status'], state)
|
||||
|
||||
except Exception as e:
|
||||
# probably here something don't work
|
||||
logger.warning(f'Fail on refreshing token for {state}, row:{row}')
|
||||
logger.warning(f'Fail on refreshing token for {state!r}, row:{row}', exc_info=e)
|
||||
msg['status'] = 'error'
|
||||
|
||||
self.model.increment_refresh_tries(state)
|
||||
|
||||
Reference in new issue
Block a user