From 359ef927ab442d8712081e4a56273254788393b4 Mon Sep 17 00:00:00 2001 From: Roman Storm Date: Tue, 3 Dec 2019 10:03:14 -0800 Subject: [PATCH] add try catch --- src/Fetcher.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Fetcher.js b/src/Fetcher.js index 00d0546..cae2f9f 100644 --- a/src/Fetcher.js +++ b/src/Fetcher.js @@ -64,7 +64,12 @@ class Fetcher { } } async fetchNonce() { - config.nonce = await this.web3.eth.getTransactionCount(this.web3.eth.defaultAccount) + try { + config.nonce = await this.web3.eth.getTransactionCount(this.web3.eth.defaultAccount) + } catch(e) { + console.error('fetchNonce failed', e.message) + setTimeout(this.fetchNonce, 3000) + } } }