Fixes error logging

This commit is contained in:
Sergi Delgado Segura
2019-10-11 19:32:44 +01:00
parent b78c6ebfe7
commit a916c67cc5
3 changed files with 9 additions and 9 deletions

View File

@@ -17,7 +17,7 @@ class BlockProcessor:
except JSONRPCException as e:
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
@@ -29,7 +29,7 @@ class BlockProcessor:
except JSONRPCException as e:
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
@@ -41,7 +41,7 @@ class BlockProcessor:
except JSONRPCException as e:
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
@@ -81,7 +81,7 @@ class BlockProcessor:
except JSONRPCException as e:
# Tx decode failed returns error code -22, maybe we should be more strict here. Leaving it simple
# 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

View File

@@ -32,8 +32,8 @@ class Carrier:
elif errno == RPC_VERIFY_ERROR:
# DISCUSS: 37-transaction-rejection
# TODO: UNKNOWN_JSON_RPC_EXCEPTION is not the proper exception here. This is long due.
receipt = Receipt(delivered=False, reason=UNKNOWN_JSON_RPC_EXCEPTION)
receipt = Receipt(delivered=False, reason=RPC_VERIFY_ERROR)
logger.error("Transaction couldn't be broadcast", error=e.error)
elif errno == RPC_VERIFY_ALREADY_IN_CHAIN:
logger.info("Transaction is already in the blockchain. Getting confirmation count", txid=txid)
@@ -60,7 +60,7 @@ class Carrier:
else:
# 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)
return receipt
@@ -80,6 +80,6 @@ class Carrier:
else:
# 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

View File

@@ -30,7 +30,7 @@ def check_tx_in_chain(tx_id, logger=Logger(), tx_label='Transaction'):
else:
# 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