mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 22:24:23 +01:00
Fixes error logging
This commit is contained in:
@@ -17,7 +17,7 @@ class BlockProcessor:
|
|||||||
|
|
||||||
except JSONRPCException as e:
|
except JSONRPCException as e:
|
||||||
block = None
|
block = None
|
||||||
logger.error("Couldn't get block from bitcoind.", error_code=e)
|
logger.error("Couldn't get block from bitcoind.", error=e.error)
|
||||||
|
|
||||||
return block
|
return block
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ class BlockProcessor:
|
|||||||
|
|
||||||
except JSONRPCException as e:
|
except JSONRPCException as e:
|
||||||
block_hash = None
|
block_hash = None
|
||||||
logger.error("Couldn't get block hash.", error_code=e)
|
logger.error("Couldn't get block hash.", error=e.error)
|
||||||
|
|
||||||
return block_hash
|
return block_hash
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ class BlockProcessor:
|
|||||||
|
|
||||||
except JSONRPCException as e:
|
except JSONRPCException as e:
|
||||||
block_count = None
|
block_count = None
|
||||||
logger.error("Couldn't get block count", error_code=e)
|
logger.error("Couldn't get block count", error=e.error)
|
||||||
|
|
||||||
return block_count
|
return block_count
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ class BlockProcessor:
|
|||||||
except JSONRPCException as e:
|
except JSONRPCException as e:
|
||||||
# Tx decode failed returns error code -22, maybe we should be more strict here. Leaving it simple
|
# Tx decode failed returns error code -22, maybe we should be more strict here. Leaving it simple
|
||||||
# for the POC
|
# for the POC
|
||||||
logger.error("Can't build transaction from decoded data.", error_code=e)
|
logger.error("Can't build transaction from decoded data.", error=e.error)
|
||||||
|
|
||||||
return matches
|
return matches
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ class Carrier:
|
|||||||
|
|
||||||
elif errno == RPC_VERIFY_ERROR:
|
elif errno == RPC_VERIFY_ERROR:
|
||||||
# DISCUSS: 37-transaction-rejection
|
# DISCUSS: 37-transaction-rejection
|
||||||
# TODO: UNKNOWN_JSON_RPC_EXCEPTION is not the proper exception here. This is long due.
|
receipt = Receipt(delivered=False, reason=RPC_VERIFY_ERROR)
|
||||||
receipt = Receipt(delivered=False, reason=UNKNOWN_JSON_RPC_EXCEPTION)
|
logger.error("Transaction couldn't be broadcast", error=e.error)
|
||||||
|
|
||||||
elif errno == RPC_VERIFY_ALREADY_IN_CHAIN:
|
elif errno == RPC_VERIFY_ALREADY_IN_CHAIN:
|
||||||
logger.info("Transaction is already in the blockchain. Getting confirmation count", txid=txid)
|
logger.info("Transaction is already in the blockchain. Getting confirmation count", txid=txid)
|
||||||
@@ -60,7 +60,7 @@ class Carrier:
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
# If something else happens (unlikely but possible) log it so we can treat it in future releases
|
# If something else happens (unlikely but possible) log it so we can treat it in future releases
|
||||||
logger.error("JSONRPCException.", method='Carrier.send_transaction', error_code=e)
|
logger.error("JSONRPCException.", method='Carrier.send_transaction', error=e.error)
|
||||||
receipt = Receipt(delivered=False, reason=UNKNOWN_JSON_RPC_EXCEPTION)
|
receipt = Receipt(delivered=False, reason=UNKNOWN_JSON_RPC_EXCEPTION)
|
||||||
|
|
||||||
return receipt
|
return receipt
|
||||||
@@ -80,6 +80,6 @@ class Carrier:
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
# If something else happens (unlikely but possible) log it so we can treat it in future releases
|
# If something else happens (unlikely but possible) log it so we can treat it in future releases
|
||||||
logger.error("JSONRPCException.", method='Carrier.get_transaction', error_code=e)
|
logger.error("JSONRPCException.", method='Carrier.get_transaction', error=e.error)
|
||||||
|
|
||||||
return tx_info
|
return tx_info
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ def check_tx_in_chain(tx_id, logger=Logger(), tx_label='Transaction'):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
# ToDO: Unhandled errors, check this properly
|
# ToDO: Unhandled errors, check this properly
|
||||||
logger.error("JSONRPCException.", method='tools.check_tx_in_chain', error_code=e)
|
logger.error("JSONRPCException.", method='tools.check_tx_in_chain', error=e.error)
|
||||||
|
|
||||||
return tx_in_chain, confirmations
|
return tx_in_chain, confirmations
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user