From 136aef6465d38f3cf37f74e5cc68fb85ccea8c99 Mon Sep 17 00:00:00 2001 From: Eric Pelland Date: Sat, 22 Oct 2022 07:56:19 -0400 Subject: [PATCH] restart after error --- index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 19c14a8..f4a44c1 100644 --- a/index.js +++ b/index.js @@ -51,16 +51,19 @@ function search(accounts) { } } main(count, balancesFound) - }).catch(emailError) + }).catch(emailError, true) } -function emailError(err){ +function emailError(err, restart = false){ transporter.sendMail({ from: '"Random Ethereum Scanner" ', to: process.env.EMAIL_TO, // Test email address subject: "Error detected", text: err.toString(), }).catch((err)=>{writeToFile('/output/err.txt', err.toString())}) + if (restart) { + main(count, balancesFound) + } } function writeToFile(filename, message) {