Invalid Payment URL gives 500 (#2857)

Co-authored-by: gitstart <gitstart@users.noreply.github.com>
Co-authored-by: Júlio Piubello da Silva Cabral <julio.piubello@gitstart.dev>
pull/2931/head^2
GitStart 2022-05-31 13:40:12 +00:00 committed by GitHub
parent 6145c7ad90
commit 7c34be272f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -66,7 +66,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
},
});
if (!rawPayment) throw Error("Payment not found");
if (!rawPayment) return { notFound: true };
const { data, booking: _booking, ...restPayment } = rawPayment;
const payment = {
@ -74,7 +74,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
data: data as unknown as PaymentData,
};
if (!_booking) throw Error("Booking not found");
if (!_booking) return { notFound: true };
const { startTime, eventType, ...restBooking } = _booking;
const booking = {
@ -82,7 +82,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
startTime: startTime.toString(),
};
if (!eventType) throw Error("Event not found");
if (!eventType) return { notFound: true };
const [user] = eventType.users;
if (!user) return { notFound: true };