« get me outta code hell

handle missing data files more gracefully - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-02-05 08:24:10 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-02-05 09:13:04 -0400
commitf10d5559731a18097dcd6921e2bb343c36269407 (patch)
treea38d7877998072811e30b34636b14cd3ab69f2f6 /src/util
parentf0af4edfa87e9518703b7c9ab35244911f0a3ac2 (diff)
handle missing data files more gracefully
Diffstat (limited to 'src/util')
-rw-r--r--src/util/io.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/util/io.js b/src/util/io.js
index 6cc89b56..12e87f4d 100644
--- a/src/util/io.js
+++ b/src/util/io.js
@@ -12,7 +12,9 @@ export async function findFiles(dataPath, {
   try {
     files = await readdir(dataPath);
   } catch (error) {
-    throw new AggregateError([error], `Failed to list files from ${dataPath}`);
+    throw Object.assign(
+      new AggregateError([error], `Failed to list files from ${dataPath}`),
+      {code: error.code});
   }
 
   return files