From 5881facbea7c62d4f86b5446036ed4477b917a61 Mon Sep 17 00:00:00 2001 From: Miles Richardson Date: Wed, 9 Feb 2022 01:18:26 +0000 Subject: [PATCH] Fix bug in 'updateDocs' when latest version has no 'content/casts' - Since latest version (as of v0.3.0) does not include the 'content/casts' root, but the code includes it as part of the 'paths.asciinema' root, the script was failing when copying the "latest" version of asciinema from the archive directory, since it didn't exist - To fix this, change the thrown error to a printed warning instead, since this should be tolerable --- content-scripts/updateDocs.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/content-scripts/updateDocs.js b/content-scripts/updateDocs.js index 656b9aec..bb9f4b2e 100644 --- a/content-scripts/updateDocs.js +++ b/content-scripts/updateDocs.js @@ -772,11 +772,14 @@ const copyLatestDocsFromArchive = async ({ const newVersionExists = await fs.pathExists(newVersionDir); + // This used to throw an error instead of a warning. It will happen when a + // resource root did not have any updates in the latest version (e.g., the + // `casts` directory stopped existing after `v3.0.0`). if (!newVersionExists) { - throw new Error( - "failed to copy latest because version does not exist:", - newVersion + console.warn( + `WARNING: cannot copy ${newVersion} at ${newVersionDir} (does not exist) to ${latestDir}` ); + return; } await fs.copy(newVersionDir, latestDir);