chore: Couple fixes to improve error reporting (#16895)

* chore: Couple fixes to improve error reporting

* tweak: Fix error message

* refactor: Use findUniqueOrThrow instead of guard

* fix: Broken test, missing ID - suspect it passes because only one record exists

* chore: Minor refactor to split ZodEffect from ZodType

* fix: Satify typescript
This commit is contained in:
Alex van Andel authored and GitHub committed 2024-10-01 09:18:51 -03:00
1 parent 4b6a389212
commit a95729f4a1
9 files changed
+31 -28

No files matched your search

@@ -3,7 +3,7 @@ import type { z } from "zod";
import { SUCCESS_STATUS } from "@calcom/platform-constants";
import type { ApiResponse, ApiErrorResponse } from "@calcom/platform-types";
import type { schemaBookingCancelParams } from "@calcom/prisma/zod-utils";
import type { bookingCancelSchema } from "@calcom/prisma/zod-utils";
import http from "../lib/http";
@@ -12,7 +12,7 @@ interface IUseCancelBooking {
onError?: (err: ApiErrorResponse | Error) => void;
}
type inputParams = z.infer<typeof schemaBookingCancelParams>;
type inputParams = z.infer<typeof bookingCancelSchema>;
export const useCancelBooking = (
{ onSuccess, onError }: IUseCancelBooking = {