fix validation error

This commit is contained in:
Thomas Ruoff
2020-09-03 00:24:03 +02:00
committed by Thomas Ruoff
parent b92ff0e3d8
commit ef4c8ce24a

View File

@@ -47,7 +47,10 @@ export async function createBooking({
if (booking.days.some((day: string) => bookedDays.includes(day))) {
const error = new mongoose.Error.ValidationError(booking)
error.addError('endDate', new mongoose.Error.ValidatorError())
error.addError(
'endDate',
new mongoose.Error.ValidatorError({ message: 'Schon gebucht' })
)
throw error
}