restart after error
This commit is contained in:
parent
76b698ada1
commit
136aef6465
7
index.js
7
index.js
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue