1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
class JSONRPCError(Exception):
"""Error to indicate a JSON RPC problem."""
def __init__(self, code, message):
super().__init__()
self._code = code
self._message = message
@property
def code(self):
return self._code
@property
def message(self):
return self._message
def __str__(self):
return f"JSONRPCError (code: {self.code}, message: {self.message})"
class SHCException(Exception):
"""Generic SHC exception."""
def __init__(self, message):
super().__init__()
self._message = message
@property
def message(self):
return self._message
def __str__(self):
return f"SHC Error (message: {self.message})"
class SHCConnectionError(Exception):
"""Error to indicate a connection problem."""
class SHCAuthenticationError(Exception):
"""Error to indicate an authentication problem."""
class SHCRegistrationError(SHCException):
"""Error to indicate an error during client registration."""
class SHCSessionError(SHCException):
"""Error to indicate a session problem."""
|