Skip to content

Commit

Permalink
feat(ew): use NonRetriableError if stripe missing
Browse files Browse the repository at this point in the history
  • Loading branch information
jbranchaud authored and kodiakhq[bot] committed Mar 27, 2024
1 parent f1a2d5e commit 8081b7f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Expand Up @@ -5,6 +5,7 @@ import {loadSanityProduct} from './index'
import {sanityWriteClient} from 'utils/sanity-server'
import {SANITY_WEBHOOK_EVENT} from '../sanity-inngest-events'
import {paymentOptions} from 'pages/api/skill/[...skillRecordings]'
import {NonRetriableError} from 'inngest'

const stripe = paymentOptions.providers.stripe?.paymentClient

Expand All @@ -16,7 +17,7 @@ export const sanityProductCreated = inngest.createFunction(
},
async ({event, step}) => {
if (!stripe) {
throw new Error('Payment provider (Stripe) is missing')
throw new NonRetriableError('Payment provider (Stripe) is missing')
}

const sanityProduct = await step.run('get sanity product', async () => {
Expand Down
Expand Up @@ -2,6 +2,7 @@ import {inngest} from 'inngest/inngest.server'
import {prisma} from '@skillrecordings/database'
import {SANITY_WEBHOOK_EVENT} from '../sanity-inngest-events'
import {paymentOptions} from 'pages/api/skill/[...skillRecordings]'
import {NonRetriableError} from 'inngest'

const stripe = paymentOptions.providers.stripe?.paymentClient

Expand All @@ -13,7 +14,7 @@ export const sanityProductDeleted = inngest.createFunction(
},
async ({event, step}) => {
if (!stripe) {
throw new Error('Payment provider (Stripe) is missing')
throw new NonRetriableError('Payment provider (Stripe) is missing')
}

const {productId} = event.data
Expand Down
Expand Up @@ -4,6 +4,7 @@ import {v4} from 'uuid'
import {loadSanityProduct} from './index'
import {SANITY_WEBHOOK_EVENT} from '../sanity-inngest-events'
import {paymentOptions} from 'pages/api/skill/[...skillRecordings]'
import {NonRetriableError} from 'inngest'

const stripe = paymentOptions.providers.stripe?.paymentClient

Expand All @@ -23,7 +24,7 @@ export const sanityProductUpdated = inngest.createFunction(
},
async ({event, step}) => {
if (!stripe) {
throw new Error('Payment provider (Stripe) is missing')
throw new NonRetriableError('Payment provider (Stripe) is missing')
}

const sanityProduct = await step.run('get sanity product', async () => {
Expand Down
@@ -1,6 +1,5 @@
import {inngest} from 'inngest/inngest.server'
import {STRIPE_WEBHOOK_RECEIVED_EVENT} from '@skillrecordings/inngest'
import {Redis} from '@upstash/redis'
import {prisma} from '@skillrecordings/database'
import {NonRetriableError} from 'inngest'
import {postToSlack} from '@skillrecordings/skill-api'
Expand All @@ -17,7 +16,7 @@ export const stripeWebhookReceived = inngest.createFunction(
{event: STRIPE_WEBHOOK_RECEIVED_EVENT},
async ({event, step}) => {
if (!stripe) {
throw new Error('Payment provider (Stripe) is missing')
throw new NonRetriableError('Payment provider (Stripe) is missing')
}

const stripeAccountId = await step.run(
Expand Down

0 comments on commit 8081b7f

Please sign in to comment.