Skip to content

Commit

Permalink
chore: Change Error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Khaledgarbaya committed Feb 19, 2018
1 parent 62a294c commit ee37629
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/utils/validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,15 @@ const countInvalidEntities = (validationData) => {
}
return entities
}, {})
return Object.keys(entityCount).map((key) => `Invalid ${key}:${entityCount[key]}`)
return Object.keys(entityCount).map((key) => `${key}:${entityCount[key]}`)
}

const assertPayload = (payload) => {
const result = Joi.validate(payload, payloadSchema, {allowUnknown: true, abortEarly: false})
if (result.error) {
attachEntityName(result.error.details, payload)
const invalidEntityCount = countInvalidEntities(result.error.details).join('\n')
result.error.message = `Payload validation error:
${invalidEntityCount}
Get further details in the error log file`
result.error.message = `${invalidEntityCount} - Get further details in the error log file`
delete result.error._object
throw result.error
}
Expand Down

0 comments on commit ee37629

Please sign in to comment.