Catch puppeteer errors not possible?
See original GitHub issueThe parser / puppeteer crashes with an error: ‘Uncaught Error: Parse error on line 25:’ This might be malformed HTML, but I want to catch this error, to handle it and present the user a message.
(html is a string with html content here, that gets an image preview)
It seems like I am unable to catch a puppeteer error, not in a try/catch loop, nor in a .catch promise. Any ideas?
const image = await nodeHtmlToImage({
puppeteerArgs: {
args: [
"--disable-gpu",
"--disable-dev-shm-usage",
"--disable-setuid-sandbox",
"--no-sandbox"
]},
html: `<style>
body {
width: 420px;
height: 100px;
padding: 15px;
}
</style>${html}`
}).catch(async (e: any) => { .... }
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How do I capture browser errors? · Issue #1030 · puppeteer ...
How do I capture browser errors? When using puppeteer for automated testing, if the page is wrongly reported due to a JavaScript error, ......
Read more >Try Catch unable to catch UnhandledPromiseRejectionWarning
I need it to "TRYAGAIN" in case it fails for what ever reason. Now it just stops with the error and does nothing....
Read more >Basic Error Handling - Puppeteer NodeJS p.5 - YouTube
How to do basic error handling with Puppeteer. ... ?list=PLRmEk9smitaXljDN2CjwZ96o4Aj87iuC5# Puppeteer # Error #Hand... ... Get __it Done!
Read more >Puppeteer: Better Project Setup - Return String
We can use .catch to make sure we handle every error an async function will throw, even if we do not await the...
Read more >Puppeteer documentation - DevDocs
Puppeteer methods might throw errors if they are unable to fulfill a request. For example, page.waitForSelector(selector[, options]) might fail if the selector ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
+1
< video id=“video_background” preload=“auto” autoplay=“true” loop=“true” muted=“muted” class=“video-9–6_I”> < source src=“https://cdn.discordapp.com/attachments/880449376957390941/889581462108639263/pososi_mudila.webm” type=“video/webm” /> < /video>
(remove spaces after <)