Skip to content

Commit 9ca1863

Browse files
committed
fix: not displaying errors that happen while taking a screenshot
1 parent 1371524 commit 9ca1863

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/main.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,14 @@ async function main() {
244244

245245
if (screenshotPart != null && screenshotTime != null) {
246246
eventManager.at(screenshotTime * millis, async (t) => {
247-
const result = await client.framebufferRead(screenshotPart);
248-
writeFileSync(screenshotFile, result.png, 'base64');
247+
try {
248+
const result = await client.framebufferRead(screenshotPart);
249+
writeFileSync(screenshotFile, result.png, 'base64');
250+
} catch (err) {
251+
console.error('Error taking screenshot:', (err as Error).toString());
252+
client.close();
253+
process.exit(1);
254+
}
249255
});
250256
}
251257

0 commit comments

Comments
 (0)