Hi, I'm Ivan 👋
For any questions or inquiries, you can write to me at ivan@buglesstack.com
Implementation Guide
Get your access token from https://app.buglesstack.com before implementing the code.
Wrap your Puppeteer code in a try/catch block and send error data to Buglesstack:
// .. assuming you already have your Puppeteer browser and page initialized
try {
await page.goto('https://www.google.com/search?q=puppeteer');
await page.waitForSelector('[name="q"]');
}
catch (error) {
// Prepare buglesstack data
const buglesstackData = {
url: page.url(),
screenshot: await page.screenshot({ encoding: 'base64' }),
html: await page.content(),
metadata: {},
message: error.message,
stack: error.stack
};
// Get your access token from https://app.buglesstack.com
const ACCESS_TOKEN = 'HERE_YOUR_ACCESS_TOKEN';
// Send error to buglesstack
await axios.post('https://app.buglesstack.com/api/v1/crashes', buglesstackData, {
headers: {
Authorization: `Bearer ${ACCESS_TOKEN}`,
'Content-Type': 'application/json'
}
});
// Re-throw the error to propagate it
throw error;
}
How it works:
- Wrap your Puppeteer operations in a try/catch block
- When an error occurs, capture relevant data (URL, screenshot, HTML)
- Send the error data to Buglesstack's API
- Re-throw the error to maintain your application's error flow