mirror of
https://github.com/KevinMidboe/ISPDowntimeMonitor.git
synced 2025-12-08 20:29:07 +00:00
clseBrowser func extended to exit w/ code.
This commit is contained in:
@@ -55,8 +55,7 @@ const exitWithError = (err, message=undefined) => {
|
|||||||
if (config.debug === true)
|
if (config.debug === true)
|
||||||
console.error(err)
|
console.error(err)
|
||||||
|
|
||||||
closeBrowser();
|
closeBrowserAndExit(1);
|
||||||
process.exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const dismissCookiePrompt = page => {
|
const dismissCookiePrompt = page => {
|
||||||
@@ -114,8 +113,9 @@ const webscraper = async pageURL => {
|
|||||||
.catch(err => exitWithError(err, `Unable to reach url: ${pageURL}`))
|
.catch(err => exitWithError(err, `Unable to reach url: ${pageURL}`))
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeBrowser() {
|
function closeBrowserAndExit(status=0) {
|
||||||
browser.close();
|
browser.close();
|
||||||
|
process.exit(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ function run() {
|
|||||||
.then(page => getServiceMessages(page))
|
.then(page => getServiceMessages(page))
|
||||||
.then(serviceMessages => commitServiceEventToDatabase(serviceMessages, pdfFilename))
|
.then(serviceMessages => commitServiceEventToDatabase(serviceMessages, pdfFilename))
|
||||||
.then(serviceMessages => notifyIfDown(serviceMessages))
|
.then(serviceMessages => notifyIfDown(serviceMessages))
|
||||||
.then(closeBrowser)
|
.then(closeBrowserAndExit)
|
||||||
}
|
}
|
||||||
|
|
||||||
run();
|
run();
|
||||||
|
|||||||
Reference in New Issue
Block a user