From ef4c8ce24a64312a2de6bf46ce3a5e0e4c7de9b0 Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Thu, 3 Sep 2020 00:24:03 +0200 Subject: [PATCH] fix validation error --- db/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 }