Skip to content

Commit

Permalink
fix: not displaying errors that happen while taking a screenshot
Browse files Browse the repository at this point in the history
  • Loading branch information
urish committed Nov 21, 2024
1 parent 1371524 commit 9ca1863
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,14 @@ async function main() {

if (screenshotPart != null && screenshotTime != null) {
eventManager.at(screenshotTime * millis, async (t) => {
const result = await client.framebufferRead(screenshotPart);
writeFileSync(screenshotFile, result.png, 'base64');
try {
const result = await client.framebufferRead(screenshotPart);
writeFileSync(screenshotFile, result.png, 'base64');
} catch (err) {
console.error('Error taking screenshot:', (err as Error).toString());
client.close();
process.exit(1);
}
});
}

Expand Down

0 comments on commit 9ca1863

Please sign in to comment.