exceptions.py
1 # SAM exceptions 2 3 class SAMException(IOError): 4 """Base class for SAM exceptions""" 5 6 class CantReachPeer(SAMException): 7 """The peer exists, but cannot be reached""" 8 9 class DuplicatedDest(SAMException): 10 """The specified Destination is already in use""" 11 12 class DuplicatedId(SAMException): 13 """The nickname is already associated with a session""" 14 15 class I2PError(SAMException): 16 """A generic I2P error""" 17 18 class InvalidId(SAMException): 19 """STREAM SESSION ID doesn't exist""" 20 21 class InvalidKey(SAMException): 22 """The specified key is not valid (bad format, etc.)""" 23 24 class KeyNotFound(SAMException): 25 """The naming system can't resolve the given name""" 26 27 class PeerNotFound(SAMException): 28 """The peer cannot be found on the network""" 29 30 class Timeout(SAMException): 31 """The peer cannot be found on the network""" 32 33 SAM_EXCEPTIONS = { 34 "CANT_REACH_PEER": CantReachPeer, 35 "DUPLICATED_DEST": DuplicatedDest, 36 "DUPLICATED_ID": DuplicatedId, 37 "I2P_ERROR": I2PError, 38 "INVALID_ID": InvalidId, 39 "INVALID_KEY": InvalidKey, 40 "KEY_NOT_FOUND": KeyNotFound, 41 "PEER_NOT_FOUND": PeerNotFound, 42 "TIMEOUT": Timeout, 43 } 44