Skip to content

Scheduling infrastructure for absolutely everyone.

Fix 500 errors if data is invalid (#2886)

Hariom Balhara40c81ee4059d
diff --git a/apps/web/pages/event-types/[type].tsx b/apps/web/pages/event-types/[type].tsx
index ad387081397..ca4e604d9b7 100644
--- a/apps/web/pages/event-types/[type].tsx
+++ b/apps/web/pages/event-types/[type].tsx
@@ -2294,6 +2294,12 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
const session = await getSession({ req });
const typeParam = parseInt(asStringOrThrow(query.type));
+ if (Number.isNaN(typeParam)) {
+ return {
+ notFound: true,
+ };
+ }
+
if (!session?.user?.id) {
return {
redirect: {
@@ -2406,7 +2412,11 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
},
});
- if (!rawEventType) throw Error("Event type not found");
+ if (!rawEventType) {
+ return {
+ notFound: true,
+ };
+ }
const credentials = await prisma.credential.findMany({
where: {