From 26616713d68ee3336e4f39a6cc0565fe968041b1 Mon Sep 17 00:00:00 2001 From: Jakob Jung Date: Tue, 18 Feb 2025 16:41:17 +0100 Subject: [PATCH] Add error handling for missing screenshot file in renderAndConvertAsync --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 87b7ccb..fcde2f3 100644 --- a/index.js +++ b/index.js @@ -174,7 +174,10 @@ async function renderAndConvertAsync(browser) { console.log(`Rendering ${url} to image...`); await renderUrlToImageAsync(browser, pageConfig, url, tempPath); - + if (!(await fsExtra.pathExists(tempPath))) { + console.error(`Screenshot fehlt: ${tempPath}`); + return; + } console.log(`Converting rendered screenshot of ${url} to grayscale...`); await convertImageToKindleCompatiblePngAsync( pageConfig,