We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 300e25a commit 192f879Copy full SHA for 192f879
1 file changed
src/app/api/gateway/proxy/route.ts
@@ -107,11 +107,19 @@ export async function POST(request: NextRequest) {
107
108
const { instanceId, orgId } = resolved
109
110
- const hasFunds = await checkSufficientBalance(orgId, 0.001)
111
- if (!hasFunds) {
+ try {
+ const hasFunds = await checkSufficientBalance(orgId, 0.001)
112
+ if (!hasFunds) {
113
+ return NextResponse.json(
114
+ { error: 'Insufficient credit balance. Please add credits.' },
115
+ { status: 402 },
116
+ )
117
+ }
118
+ } catch (err) {
119
+ console.error('Credit check error:', err)
120
return NextResponse.json(
- { error: 'Insufficient credit balance. Please add credits.' },
- { status: 402 },
121
+ { error: 'Billing service unavailable' },
122
+ { status: 503 },
123
)
124
}
125
0 commit comments