« get me outta code hell

composite: drop dubious error annotation, caughtErrorKind - 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>2024-06-02 22:02:10 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-06-02 22:02:10 -0300
commit7c5caf5923a7771de16e1479539e66c7a693b186 (patch)
tree5837b32d903a8a49236290397ed59b490ce37ad1 /src/data
parenta33dece543be88dfe18a69091e17a768a3062880 (diff)
composite: drop dubious error annotation, caughtErrorKind
This logic doesn't appear to be necessary to avoid overriding
compositional-infrastructure errors (or nested errors) when
reporting, really.
Diffstat (limited to 'src/data')
-rw-r--r--src/data/composite.js38
1 files changed, 7 insertions, 31 deletions
diff --git a/src/data/composite.js b/src/data/composite.js
index 8b86c622..862235bd 100644
--- a/src/data/composite.js
+++ b/src/data/composite.js
@@ -1,6 +1,6 @@
 import {inspect} from 'node:util';
 
-import {annotateError, decorateErrorWithIndex, openAggregate, withAggregate}
+import {decorateErrorWithIndex, openAggregate, withAggregate}
   from '#aggregate';
 import {colors} from '#cli';
 import {empty, filterProperties, stitchArrays, typeAppearance, unique}
@@ -497,13 +497,6 @@ templateCompositeFrom.symbol = Symbol();
 export const continuationSymbol = Symbol.for('compositeFrom: continuation symbol');
 export const noTransformSymbol = Symbol.for('compositeFrom: no-transform symbol');
 
-export const compositionalErrorSymbol = Symbol.for('compositeFrom: compositional error marker');
-
-function annotateCompositionalError(error) {
-  error[compositionalErrorSymbol] = true;
-  return error;
-}
-
 export function compositeFrom(description) {
   const {annotation} = description;
   const compositionName = getCompositionName(description);
@@ -882,9 +875,7 @@ export function compositeFrom(description) {
               return tokenValue;
             case 'input.updateValue':
               if (!expectingTransform)
-                throw annotateError(
-                  new Error(`Unexpected input.updateValue() accessed on non-transform call`),
-                  annotateCompositionalError);
+                throw new Error(`Unexpected input.updateValue() accessed on non-transform call`);
               return valueSoFar;
             case 'input.myself':
               return initialDependencies['this'];
@@ -893,9 +884,7 @@ export function compositeFrom(description) {
             case 'input':
               return initialDependencies[token];
             default:
-              throw annotateError(
-                new TypeError(`Unexpected input shape ${tokenShape}`),
-                annotateCompositionalError);
+              throw new TypeError(`Unexpected input shape ${tokenShape}`);
           }
         });
 
@@ -1022,9 +1011,7 @@ export function compositeFrom(description) {
             case 'input.updateValue':
               return input.updateValue();
             default:
-              throw annotateError(
-                new Error(`Unexpected token ${tokenShape} as dependency`),
-                annotateCompositionalError);
+              throw new Error(`Unexpected token ${tokenShape} as dependency`);
           }
         })
 
@@ -1189,22 +1176,12 @@ export function compositeFrom(description) {
             args.filter(arg => arg !== continuationSymbol);
         }
 
-        let caughtErrorKind = null;
         try {
           return expose[name](...args);
-        } catch (caughtError) {
-          if (caughtError[compositionalErrorSymbol]) {
-            caughtErrorKind = 'compositional';
-          } else {
-            caughtErrorKind = 'generic';
-          }
-          throw caughtError;
         } finally {
-          if (caughtErrorKind === null || caughtErrorKind === 'generic') {
-            stepsFirstTimeCalling[i] = false;
-            if (reviewAccessedDependencies) {
-              reviewAccessedDependencies();
-            }
+          stepsFirstTimeCalling[i] = false;
+          if (reviewAccessedDependencies) {
+            reviewAccessedDependencies();
           }
         }
       };
@@ -1383,7 +1360,6 @@ export function compositeFrom(description) {
           `Error computing composition` +
           (annotation ? ` ${annotation}` : ''));
         error.cause = thrownError;
-        annotateCompositionalError(error);
         throw error;
       }
     };