<s> """<STR_LIT>""" <EOL> class BitcoinException ( Exception ) : <EOL> """<STR_LIT>""" <EOL> GENERIC = - <NUM_LIT:1> <EOL> SAFEMODE = - <NUM_LIT:2> <EOL> INVALID_AMOUNT = - <NUM_LIT:3> <EOL> SEND_ERROR = - <NUM_LIT:4> <EOL> INVALID_TRANSACTION_ID = - <NUM_LIT:5> <EOL> INSUFFICIENT_FUNDS = - <NUM_LIT:6> <EOL> OUT_OF_MEMORY = - <NUM_LIT:7> <EOL> INVALID_PARAMETER = - <NUM_LIT:8> <EOL> NOT_CONNECTED = - <NUM_LIT:9> <EOL> DOWNLOADING_BLOCKS = - <NUM_LIT:10> <EOL> PARSE_ERROR = - <NUM_LIT> <EOL> MISSING_METHOD = - <NUM_LIT> <EOL> METHOD_MUST_BE_STRING = - <NUM_LIT> <EOL> PARAMS_MUST_BE_ARRAY = - <NUM_LIT> <EOL> METHOD_NOT_FOUND = - <NUM_LIT> <EOL> def __init__ ( self , error ) : <EOL> Exception . __init__ ( self , error [ '<STR_LIT:message>' ] ) <EOL> self . code = error [ '<STR_LIT:code>' ] <EOL> class SafeMode ( BitcoinException ) : <EOL> """<STR_LIT>""" <EOL> class InvalidAmount ( BitcoinException ) : <EOL> """<STR_LIT>""" <EOL> class SendError ( BitcoinException ) : <EOL> """<STR_LIT>""" <EOL> class InvalidTransactionID ( BitcoinException ) : <EOL> """<STR_LIT>""" <EOL> class InsufficientFunds ( BitcoinException ) : <EOL> """<STR_LIT>""" <EOL> class OutOfMemory ( BitcoinException ) : <EOL> """<STR_LIT>""" <EOL> class InvalidParameter ( BitcoinException ) : <EOL> """<STR_LIT>""" <EOL> class NotConnected ( BitcoinException ) : <EOL> """<STR_LIT>""" <EOL> class DownloadingBlocks ( BitcoinException ) : <EOL> """<STR_LIT>""" <EOL> _exception_map = { <EOL> BitcoinException . SAFEMODE : SafeMode , <EOL> BitcoinException . INVALID_AMOUNT : InvalidAmount , <EOL> BitcoinException . SEND_ERROR : SendError , <EOL> BitcoinException . INVALID_TRANSACTION_ID : InvalidTransactionID , <EOL> BitcoinException . INSUFFICIENT_FUNDS : InsufficientFunds , <EOL> BitcoinException . OUT_OF_MEMORY : OutOfMemory , <EOL> BitcoinException . INVALID_PARAMETER : InvalidParameter , <EOL> BitcoinException . NOT_CONNECTED : NotConnected , <EOL> BitcoinException . DOWNLOADING_BLOCKS : DownloadingBlocks <EOL> } <EOL> def _wrap_exception ( error ) : <EOL> """<STR_LIT>""" <EOL> return _exception_map . get ( error [ '<STR_LIT:code>' ] , BitcoinException ) ( error ) </s>
