mirror of
https://github.com/no2chem/wideq.git
synced 2025-05-17 15:50:10 -07:00
Expose an exception for "not connected" errors
This commit is contained in:
parent
caeb63d598
commit
0b14dd5832
9
wideq.py
9
wideq.py
@ -75,6 +75,13 @@ class NotLoggedInError(APIError):
|
||||
pass
|
||||
|
||||
|
||||
class NotConnectedError(APIError):
|
||||
"""The service can't contact the specified device."""
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
class TokenError(APIError):
|
||||
"""An authentication token was rejected."""
|
||||
|
||||
@ -124,6 +131,8 @@ def lgedm_post(url, data=None, access_token=None, session_id=None):
|
||||
message = out['returnMsg']
|
||||
if code == "0102":
|
||||
raise NotLoggedInError()
|
||||
elif code == "0106":
|
||||
raise NotConnectedError()
|
||||
else:
|
||||
raise APIError(code, message)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user