Skip to content

Commit f81d294

Browse files
committed
Log autotopup error
1 parent a118be5 commit f81d294

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

packages/billing/src/auto-topup.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import db from 'common/db'
22
import * as schema from 'common/db/schema'
3-
import { eq } from 'drizzle-orm'
4-
import { stripeServer } from 'common/util/stripe'
5-
import { logger } from 'common/util/logger'
3+
import { CREDIT_PRICING } from 'common/src/constants'
4+
import { env } from 'common/src/env.mjs'
65
import { convertCreditsToUsdCents } from 'common/util/currency'
7-
import { getUserCostPerCredit } from './conversion'
6+
import { getNextQuotaReset } from 'common/util/dates'
7+
import { logger } from 'common/util/logger'
8+
import { stripeServer } from 'common/util/stripe'
9+
import { eq } from 'drizzle-orm'
810
import type Stripe from 'stripe'
9-
import { processAndGrantCredit } from './grant-credits'
1011
import { calculateUsageAndBalance } from './balance-calculator'
11-
import { generateOperationIdTimestamp } from './utils'
12-
import { env } from 'common/src/env.mjs'
13-
import { CREDIT_PRICING } from 'common/src/constants'
12+
import { getUserCostPerCredit } from './conversion'
13+
import { processAndGrantCredit } from './grant-credits'
1414
import {
15-
grantOrganizationCredits,
1615
calculateOrganizationUsageAndBalance,
16+
grantOrganizationCredits,
1717
} from './org-billing'
18-
import { getNextQuotaReset } from 'common/util/dates'
18+
import { generateOperationIdTimestamp } from './utils'
1919

2020
const MINIMUM_PURCHASE_CREDITS = 500
2121

@@ -100,6 +100,8 @@ export async function validateAutoTopupStatus(
100100
validPaymentMethod,
101101
}
102102
} catch (error) {
103+
logger.error({ error }, 'Failed to validate auto top-up status')
104+
103105
const blockedReason =
104106
error instanceof AutoTopupValidationError
105107
? error.message

0 commit comments

Comments
 (0)