Answer the question
In order to leave comments, you need to log in
How to change custom error celebrate?
doing validation
router.post('/signin', celebrate({
body: Joi.object().keys({
email: Joi.string().required().email(),
password: Joi.string().required()
})
}), login);
{"statusCode":400,"error":"Bad Request","message":"celebrate request validation failed","validation":{"body":{"source":"body","keys":["email"],"message":"\"email\" must be a valid email"}}}
[Segments.BODY]: Joi.object().keys({
value: Joi.string().required().error(new Error('Value is required and has to be a text!')),
})
{"generatedMessage":false,"code":"ERR_ASSERTION","actual":false,"expected":true,"operator":"=="}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question