Skip to content

Commit a4bc079

Browse files
chore: update to see webhook creation error handling to see error in prod (#14071)
* chore: update to see erorr in prod * fix: keep try ctach * chore: add logger from lib * chore: improvement --------- Co-authored-by: Udit Takkar <udit222001@gmail.com> Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
1 parent 4af209f commit a4bc079

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

packages/app-store/paypal/lib/Paypal.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { v4 as uuidv4 } from "uuid";
33
import z from "zod";
44

55
import { IS_PRODUCTION, WEBAPP_URL } from "@calcom/lib/constants";
6+
import logger from "@calcom/lib/logger";
67
import prisma from "@calcom/prisma";
78

89
class Paypal {
@@ -197,12 +198,15 @@ class Paypal {
197198
body: JSON.stringify(body),
198199
});
199200

200-
if (response.ok) {
201-
const result = await response.json();
202-
return result.id as string;
201+
if (!response.ok) {
202+
const message = `${response.statusText}: ${JSON.stringify(await response.json())}`;
203+
throw new Error(message);
203204
}
204-
} catch (error) {
205-
console.error(error);
205+
206+
const result = await response.json();
207+
return result.id as string;
208+
} catch (e) {
209+
logger.error("Error creating webhook", e);
206210
}
207211

208212
return false;

0 commit comments

Comments
 (0)