Skip to content

Commit

Permalink
Improve schema error message
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed May 22, 2022
1 parent 3faf94b commit d7de189
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/config/normalize/lib/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ const throwValidationError = function (
) {
const propPath = decodePointer(instancePath).join('.')
const propPathA = propPath === '' ? propPath : `${propPath} `
const error = new Error(`must be valid: ${propPathA}${message}.`)
const messageA = `${propPathA}${message}.`
const messageB = messageA.startsWith('must')
? messageA
: `must be valid: ${messageA}`
const error = new Error(messageB)
throw handleValidateError(error, opts)
}

0 comments on commit d7de189

Please sign in to comment.