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) {