diff options
| author | (quasar) nebula <qznebula@protonmail.com> | 2025-11-25 10:06:48 -0400 |
|---|---|---|
| committer | (quasar) nebula <qznebula@protonmail.com> | 2025-11-25 10:06:48 -0400 |
| commit | 3afd5e8f8d6b08ccb9e49e53b0da4423a7d23542 (patch) | |
| tree | 7f5da23d280a7041c75b9b7fce248ebe4f26817f /src/data/composite.js | |
| parent | 85c80fbdb4780e5b39296ae1f3081afceb5d8741 (diff) | |
composite: nicer input validation error messaging
Diffstat (limited to 'src/data/composite.js')
| -rw-r--r-- | src/data/composite.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/data/composite.js b/src/data/composite.js index e5873cf5..3dad52f2 100644 --- a/src/data/composite.js +++ b/src/data/composite.js @@ -886,7 +886,7 @@ export function compositeFrom(description) { } }); - withAggregate({message: `Errors in input values provided to ${compositionName}`}, ({push}) => { + withAggregate({message: `Errors validating input values provided to ${compositionName}`}, ({push}) => { for (const {dynamic, name, value, description} of stitchArrays({ dynamic: inputsMayBeDynamicValue, name: inputNames, @@ -896,9 +896,10 @@ export function compositeFrom(description) { if (!dynamic) continue; try { validateInputValue(value, description); - } catch (error) { - error.message = `${name}: ${error.message}`; - push(error); + } catch (caughtError) { + push(new Error( + `Error validating input ${name}: ` + inspect(value, {compact: true}), + {cause: caughtError})); } } }); |