From 3afd5e8f8d6b08ccb9e49e53b0da4423a7d23542 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 25 Nov 2025 10:06:48 -0400 Subject: composite: nicer input validation error messaging --- src/data/composite.js | 9 +++++---- 1 file 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})); } } }); -- cgit 1.3.0-6-gf8a5