diff --git a/db/index.ts b/db/index.ts index 4e3eb9d..4ce044e 100644 --- a/db/index.ts +++ b/db/index.ts @@ -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 }