The previous version was relying only on HTTPError exception from the requests package. To make the code more generic and to raise meaningful exceptions, every method and decorator handles client/server errors.
The following exceptions have been added:
CredentialError: when incorrect username/password are used
LockError: when there is a race condition with another application, while trying to obtain the lock
CodeError: when the used code is not correct
InvalidSector: when using arm() or disarm(), an invalid sector is used
Cases that are covered are the following:
Acquire the lock when it has been acquired already by someone else
Incorrect username or password
Incorrect code
Call a method without obtaining the lock
Call any method when a token is expired / is invalid
Call arm/disarm for an invalid area
Call the lock when it has been obtained already
Call unlock without calling lock
Any method call that requires a lock, but is called without obtaining the lock
Overview
The previous version was relying only on
HTTPError
exception from therequests
package. To make the code more generic and to raise meaningful exceptions, every method and decorator handles client/server errors.The following exceptions have been added:
CredentialError
: when incorrect username/password are usedLockError
: when there is a race condition with another application, while trying to obtain the lockCodeError
: when the usedcode
is not correctInvalidSector
: when usingarm()
ordisarm()
, an invalid sector is usedCases that are covered are the following: