Skip to content

Commit

Permalink
Do not import stripe lib in getServerErrorFromUnknown
Browse files Browse the repository at this point in the history
  • Loading branch information
hbjORbj committed Feb 26, 2025
1 parent e437dfa commit 2fbbed8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/lib/server/getServerErrorFromUnknown.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Prisma } from "@prisma/client";
import Stripe from "stripe";
import type { ZodIssue } from "zod";
import { ZodError } from "zod";

Expand Down Expand Up @@ -56,8 +55,8 @@ export function getServerErrorFromUnknown(cause: unknown): HttpError {
if (isPrismaError(cause)) {
return getServerErrorFromPrismaError(cause);
}
if (cause instanceof Stripe.errors.StripeInvalidRequestError) {
return getHttpError({ statusCode: 400, cause });
if ((cause as any)?.type === "StripeInvalidRequestError") {
return getHttpError({ statusCode: 400, cause: cause as any });
}
if (cause instanceof HttpError) {
const redactedCause = redactError(cause);
Expand Down

0 comments on commit 2fbbed8

Please sign in to comment.