Skip to content

Commit

Permalink
Don't assume "page" is available in main loop exception handler
Browse files Browse the repository at this point in the history
  • Loading branch information
zieren committed Apr 17, 2022
1 parent d3a4148 commit 51e743f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -730,9 +730,11 @@ async function main() {
}
} catch (e) {
LOG.error(e);
LOG.error('URL of this error: ' + page.url());
await page.screenshot({ path: 'last_error.png', fullPage: true });
LOG.error('Screenshot stored in last_error.png');
if (page) {
LOG.error('URL of this error: ' + page.url());
await page.screenshot({ path: 'last_error.png', fullPage: true });
LOG.error('Screenshot stored in last_error.png');
}
// TODO: Detect permanent errors and quit.
}

Expand Down

0 comments on commit 51e743f

Please sign in to comment.