}
export function validateKeywordUsage(
- {schema, opts, self}: SchemaObjCxt,
+ {schema, opts, self, errSchemaPath}: SchemaObjCxt,
def: AddedKeywordDefinition,
keyword: string
): void {
if (def.validateSchema) {
const valid = def.validateSchema(schema[keyword])
if (!valid) {
- const msg = "keyword value is invalid: " + self.errorsText(def.validateSchema.errors)
+ const msg =
+ `keyword "${keyword}" value is invalid at path "${errSchemaPath}": ` +
+ self.errorsText(def.validateSchema.errors)
if (opts.validateSchema === "log") self.logger.error(msg)
else throw new Error(msg)
}