restart after error

This commit is contained in:
Eric Pelland 2022-10-22 07:56:19 -04:00
parent 76b698ada1
commit 136aef6465
1 changed files with 5 additions and 2 deletions

View File

@ -51,16 +51,19 @@ function search(accounts) {
} }
} }
main(count, balancesFound) main(count, balancesFound)
}).catch(emailError) }).catch(emailError, true)
} }
function emailError(err){ function emailError(err, restart = false){
transporter.sendMail({ transporter.sendMail({
from: '"Random Ethereum Scanner" <foo@example.com>', from: '"Random Ethereum Scanner" <foo@example.com>',
to: process.env.EMAIL_TO, // Test email address to: process.env.EMAIL_TO, // Test email address
subject: "Error detected", subject: "Error detected",
text: err.toString(), text: err.toString(),
}).catch((err)=>{writeToFile('/output/err.txt', err.toString())}) }).catch((err)=>{writeToFile('/output/err.txt', err.toString())})
if (restart) {
main(count, balancesFound)
}
} }
function writeToFile(filename, message) { function writeToFile(filename, message) {