From cb3edb0b2bdea87cd29559e4a9df2e7c062a4df7 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 17 Aug 2022 22:02:37 -0300 Subject: read static pages from directory --- src/util/io.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/util') diff --git a/src/util/io.js b/src/util/io.js index 4a6e95f3..cfd6708d 100644 --- a/src/util/io.js +++ b/src/util/io.js @@ -10,7 +10,14 @@ export async function findFiles(dataPath, { filter = () => true, joinParentDirectory = true, } = {}) { - return (await readdir(dataPath)) + let files; + try { + files = await readdir(dataPath); + } catch (error) { + throw new AggregateError([error], `Failed to list files from ${dataPath}`); + } + + return files .filter((file) => filter(file)) .map((file) => (joinParentDirectory ? path.join(dataPath, file) : file)); } -- cgit 1.3.0-6-gf8a5