diff options
Diffstat (limited to 'src/data')
-rw-r--r-- | src/data/things/validators.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/data/things/validators.js b/src/data/things/validators.js index c15a6cc7..a212b8ae 100644 --- a/src/data/things/validators.js +++ b/src/data/things/validators.js @@ -374,9 +374,11 @@ export function validateProperties(spec) { const value = object[specKey]; try { specValidator(value); - } catch (error) { - error.message = `(key: ${colors.green(specKey)}, value: ${inspect(value)}) ${error.message}`; - push(error); + } catch (caughtError) { + const keyPart = colors.green(specKey); + const valuePart = inspect(value); + const message = `Error for key ${keyPart}: ${valuePart}`; + push(new Error(message, {cause: caughtError})); } } |