Skip to content

Commit 4354977

Browse files
committed
chore(billing): improve logs to distinguish between failure modes
1 parent f646168 commit 4354977

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

apps/webapp/app/services/platform.v3.server.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ export async function getCurrentPlan(orgId: string) {
205205
firstDayOfNextMonth.setUTCHours(0, 0, 0, 0);
206206

207207
if (!result.success) {
208-
logger.error("Error getting current plan", { orgId, error: result.error });
208+
logger.error("Error getting current plan - no success", { orgId, error: result.error });
209209
return undefined;
210210
}
211211

@@ -221,7 +221,7 @@ export async function getCurrentPlan(orgId: string) {
221221

222222
return { ...result, usage };
223223
} catch (e) {
224-
logger.error("Error getting current plan", { orgId, error: e });
224+
logger.error("Error getting current plan - caught error", { orgId, error: e });
225225
return undefined;
226226
}
227227
}
@@ -232,13 +232,13 @@ export async function getLimits(orgId: string) {
232232
try {
233233
const result = await client.currentPlan(orgId);
234234
if (!result.success) {
235-
logger.error("Error getting limits", { orgId, error: result.error });
235+
logger.error("Error getting limits - no success", { orgId, error: result.error });
236236
return undefined;
237237
}
238238

239239
return result.v3Subscription?.plan?.limits;
240240
} catch (e) {
241-
logger.error("Error getting limits", { orgId, error: e });
241+
logger.error("Error getting limits - caught error", { orgId, error: e });
242242
return undefined;
243243
}
244244
}
@@ -279,12 +279,12 @@ export async function getPlans() {
279279
try {
280280
const result = await client.plans();
281281
if (!result.success) {
282-
logger.error("Error getting plans", { error: result.error });
282+
logger.error("Error getting plans - no success", { error: result.error });
283283
return undefined;
284284
}
285285
return result;
286286
} catch (e) {
287-
logger.error("Error getting plans", { error: e });
287+
logger.error("Error getting plans - caught error", { error: e });
288288
return undefined;
289289
}
290290
}
@@ -362,12 +362,12 @@ export async function getUsage(organizationId: string, { from, to }: { from: Dat
362362
try {
363363
const result = await client.usage(organizationId, { from, to });
364364
if (!result.success) {
365-
logger.error("Error getting usage", { error: result.error });
365+
logger.error("Error getting usage - no success", { error: result.error });
366366
return undefined;
367367
}
368368
return result;
369369
} catch (e) {
370-
logger.error("Error getting usage", { error: e });
370+
logger.error("Error getting usage - caught error", { error: e });
371371
return undefined;
372372
}
373373
}
@@ -396,12 +396,12 @@ export async function getUsageSeries(organizationId: string, params: UsageSeries
396396
try {
397397
const result = await client.usageSeries(organizationId, params);
398398
if (!result.success) {
399-
logger.error("Error getting usage series", { error: result.error });
399+
logger.error("Error getting usage series - no success", { error: result.error });
400400
return undefined;
401401
}
402402
return result;
403403
} catch (e) {
404-
logger.error("Error getting usage series", { error: e });
404+
logger.error("Error getting usage series - caught error", { error: e });
405405
return undefined;
406406
}
407407
}
@@ -420,12 +420,12 @@ export async function reportInvocationUsage(
420420
additionalData,
421421
});
422422
if (!result.success) {
423-
logger.error("Error reporting invocation", { error: result.error });
423+
logger.error("Error reporting invocation - no success", { error: result.error });
424424
return undefined;
425425
}
426426
return result;
427427
} catch (e) {
428-
logger.error("Error reporting invocation", { error: e });
428+
logger.error("Error reporting invocation - caught error", { error: e });
429429
return undefined;
430430
}
431431
}
@@ -448,14 +448,14 @@ export async function getEntitlement(
448448
try {
449449
const result = await client.getEntitlement(organizationId);
450450
if (!result.success) {
451-
logger.error("Error getting entitlement", { error: result.error });
451+
logger.error("Error getting entitlement - no success", { error: result.error });
452452
return {
453453
hasAccess: true as const,
454454
};
455455
}
456456
return result;
457457
} catch (e) {
458-
logger.error("Error getting entitlement", { error: e });
458+
logger.error("Error getting entitlement - caught error", { error: e });
459459
return {
460460
hasAccess: true as const,
461461
};

0 commit comments

Comments
 (0)