From eef405ef41c62ca827386627f1fb8e8b9fb7d3ef Mon Sep 17 00:00:00 2001 From: Hariom Balhara Date: Thu, 30 Jun 2022 15:09:15 +0000 Subject: [PATCH] If booking doesnt exist its 404 page but if it exists and eventType doesnt exist, log it for now and continue with the flow (#3202) --- apps/web/pages/reschedule/[uid].tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/web/pages/reschedule/[uid].tsx b/apps/web/pages/reschedule/[uid].tsx index d54e77f3bc..658b5aefd7 100644 --- a/apps/web/pages/reschedule/[uid].tsx +++ b/apps/web/pages/reschedule/[uid].tsx @@ -38,7 +38,19 @@ export async function getServerSideProps(context: GetServerSidePropsContext) { }, }); const dynamicEventSlugRef = booking?.dynamicEventSlugRef || ""; - if (!booking?.eventType && !booking?.dynamicEventSlugRef) throw Error("This booking doesn't exists"); + + if (!booking) { + return { + notFound: true, + }; + } + + if (!booking?.eventType && !booking?.dynamicEventSlugRef) { + // TODO: Show something in UI to let user know that this booking is not rescheduleable. + return { + notFound: true, + }; + } const eventType = booking.eventType ? booking.eventType : getDefaultEvent(dynamicEventSlugRef);