Merge pull request #9 from NKjoep/catch-the-errors

Call process exit when fails
This commit is contained in:
Vladimir Carrer 2018-12-05 17:08:55 +01:00 committed by GitHub
commit b0c19402fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,6 +29,15 @@ console.log(urlvalue);
console.log(fullPage);
(async () => {
try {
await execute();
} catch(e) {
console.error(e);
process.exit(1);
}
async function execute() {
const browser = await puppeteer.launch()
const page = await browser.newPage()
const d = new Date()
@ -50,4 +59,9 @@ console.log(fullPage);
if (program.pdf) await page.pdf({ path: t + " " + program.emulate + " " + d.getTime() + '.pdf' })
console.log(t)
await browser.close()
}
})()