mirror of
https://github.com/vladocar/screenshoteer.git
synced 2024-12-22 13:42:19 +01:00
Merge pull request #9 from NKjoep/catch-the-errors
Call process exit when fails
This commit is contained in:
commit
b0c19402fa
1 changed files with 34 additions and 20 deletions
14
index.js
14
index.js
|
@ -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()
|
||||
}
|
||||
|
||||
})()
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue