From dc2b361d4c22c2b64d9c3f1785559677ce5ff196 Mon Sep 17 00:00:00 2001 From: nsjames Date: Mon, 28 Aug 2023 15:21:15 +0100 Subject: [PATCH] catch errors from nodes and propagate to caller --- src/miner.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/miner.ts b/src/miner.ts index 48b77e4..45b1b30 100644 --- a/src/miner.ts +++ b/src/miner.ts @@ -66,16 +66,16 @@ export default class EosEvmMiner { ).then(x => { logger.info(`Pushed tx to ${this.config.rpcEndpoints[this.currentRpcEndpoint]}`); logger.info(x); + return true; }).catch(e => { logger.error(`Error pushing #${this.pushCount} to ${this.config.rpcEndpoints[this.currentRpcEndpoint]}`); logger.error(e); - // Too many possible reasons for this to fail, - // not necessarily an issue with the node. - // this.swapRpcEndpoint(); - - throw new Error("There was an error pushing this transaction from this EOS EVM miner."); + throw new Error( + "There was an error pushing this transaction from this EOS EVM miner: " + + e.hasOwnProperty("details") ? e.details[0].message : e.hasOwnProperty("json") ? e.json.error.details[0].message : JSON.stringify(e) + ); }); logger.info(`Latency for #${this.pushCount}: ${Date.now() - timeStarted}ms`);