« get me outta code hell

data, util: principle "translucent errors" & applications - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-11-20 14:31:58 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-11-20 14:31:58 -0400
commitf87fa920f91d36424e4613ac5da50f46418f4b19 (patch)
tree81d6bfa4d5df7419383ed8fbb8e80e03074b290d /src/data
parent87988954ad7314bee59932b0e5ef3474936ed33e (diff)
data, util: principle "translucent errors" & applications
Diffstat (limited to 'src/data')
-rw-r--r--src/data/yaml.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/data/yaml.js b/src/data/yaml.js
index 49e05266..dddf5fb2 100644
--- a/src/data/yaml.js
+++ b/src/data/yaml.js
@@ -334,6 +334,8 @@ export class FieldCombinationError extends Error {
 }
 
 export class FieldValueAggregateError extends AggregateError {
+  [Symbol.for('hsmusic.aggregate.translucent')] = true;
+
   constructor(thingConstructor, errors) {
     const constructorText =
       colors.green(thingConstructor.name);
@@ -1162,7 +1164,10 @@ export async function loadAndProcessDataDocuments({dataPath}) {
 
   for (const dataStep of dataSteps) {
     await processDataAggregate.nestAsync(
-      {message: `Errors during data step: ${colors.bright(dataStep.title)}`},
+      {
+        message: `Errors during data step: ${colors.bright(dataStep.title)}`,
+        translucent: true,
+      },
       async ({call, callAsync, map, mapAsync, push}) => {
         const {documentMode} = dataStep;
 
@@ -1407,7 +1412,7 @@ export async function loadAndProcessDataDocuments({dataPath}) {
 
         switch (documentMode) {
           case documentModes.headerAndEntries:
-            map(yamlResults, {message: `Errors processing documents in data files`},
+            map(yamlResults, {message: `Errors processing documents in data files`, translucent: true},
               decorateErrorWithFile(({documents}) => {
                 const headerDocument = documents[0];
                 const entryDocuments = documents.slice(1).filter(Boolean);