Skip to content

Commit b589ff9

Browse files
jankeromnesroboquat
authored andcommitted
[server] If getting usage-based notifications fails, log a warning instead of propagating the error to the dashboard
1 parent 6475a78 commit b589ff9

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

components/server/ee/src/workspace/gitpod-server-impl.ts

+12-7
Original file line numberDiff line numberDiff line change
@@ -2294,15 +2294,20 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
22942294
const result = await super.getNotifications(ctx);
22952295
const user = this.checkAndBlockUser("getNotifications");
22962296

2297-
const billingMode = await this.billingModes.getBillingModeForUser(user, new Date());
2298-
if (billingMode.mode === "usage-based") {
2299-
const limit = await this.billingService.checkUsageLimitReached(user);
2300-
if (limit.reached) {
2301-
result.unshift("The usage limit is reached.");
2302-
} else if (limit.almostReached) {
2303-
result.unshift("The usage limit is almost reached.");
2297+
try {
2298+
const billingMode = await this.billingModes.getBillingModeForUser(user, new Date());
2299+
if (billingMode.mode === "usage-based") {
2300+
const limit = await this.billingService.checkUsageLimitReached(user);
2301+
if (limit.reached) {
2302+
result.unshift("The usage limit is reached.");
2303+
} else if (limit.almostReached) {
2304+
result.unshift("The usage limit is almost reached.");
2305+
}
23042306
}
2307+
} catch (error) {
2308+
log.warn({ userId: user.id }, "Could not get usage-based notifications for user", { error });
23052309
}
2310+
23062311
return result;
23072312
}
23082313

0 commit comments

Comments
 (0)