diff --git a/packages/app-store/paypal/lib/Paypal.ts b/packages/app-store/paypal/lib/Paypal.ts index e430e4d9a8..bcfd9a748b 100644 --- a/packages/app-store/paypal/lib/Paypal.ts +++ b/packages/app-store/paypal/lib/Paypal.ts @@ -3,6 +3,7 @@ import { v4 as uuidv4 } from "uuid"; import z from "zod"; import { IS_PRODUCTION, WEBAPP_URL } from "@calcom/lib/constants"; +import logger from "@calcom/lib/logger"; import prisma from "@calcom/prisma"; class Paypal { @@ -197,12 +198,15 @@ class Paypal { body: JSON.stringify(body), }); - if (response.ok) { - const result = await response.json(); - return result.id as string; + if (!response.ok) { + const message = `${response.statusText}: ${JSON.stringify(await response.json())}`; + throw new Error(message); } - } catch (error) { - console.error(error); + + const result = await response.json(); + return result.id as string; + } catch (e) { + logger.error("Error creating webhook", e); } return false;