mirror of
https://github.com/derrod/legendary.git
synced 2024-12-22 17:55:27 +00:00
[api] Log 4XX login responses without 'error' property
This commit is contained in:
parent
c8a6e68bf4
commit
f19a1ba69d
|
@ -124,6 +124,9 @@ class EPCAPI:
|
||||||
if 'error' in j:
|
if 'error' in j:
|
||||||
self.log.warning(f'Login to EGS API failed with errorCode: {j["errorCode"]}')
|
self.log.warning(f'Login to EGS API failed with errorCode: {j["errorCode"]}')
|
||||||
raise InvalidCredentialsError(j['errorCode'])
|
raise InvalidCredentialsError(j['errorCode'])
|
||||||
|
elif r.status_code >= 400:
|
||||||
|
self.log.error(f'EGS API responded with status {r.status_code} but no error in response: {j}')
|
||||||
|
raise InvalidCredentialsError('Unknown error')
|
||||||
|
|
||||||
self.session.headers['Authorization'] = f'bearer {j["access_token"]}'
|
self.session.headers['Authorization'] = f'bearer {j["access_token"]}'
|
||||||
# only set user info when using non-anonymous login
|
# only set user info when using non-anonymous login
|
||||||
|
|
Loading…
Reference in a new issue