Skip to content

Commit

Permalink
add better logging
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds committed Jun 6, 2024
1 parent 9900f97 commit fd40b38
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/utils/stripe.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ export async function getCustomerIdFromSession(sessionId: string) {
`https://api.stripe.com/v1/checkout/sessions/${sessionId}`,
{ headers: { Authorization: `Bearer ${process.env.STRIPE_SECRET_KEY}` } },
)
invariantResponse(response.ok, 'Failed to retrieve session details')
if (!response.ok) {
console.error(await response.text())
throw new Error('Failed to retrieve session details')
}
const json = await response.json()

const result = SessionSchema.safeParse(json)
Expand Down Expand Up @@ -59,6 +62,7 @@ export async function getCustomerProducts(customerId: string) {
},
)
if (!response.ok) {
console.error(await response.text())
throw new Error('Failed to retrieve customer products')
}
const json = await response.json()
Expand Down

0 comments on commit fd40b38

Please sign in to comment.