diff --git a/apps/discord-bot/src/lib/command.listener.ts b/apps/discord-bot/src/lib/command.listener.ts index a539a9cca..686e2bad9 100644 --- a/apps/discord-bot/src/lib/command.listener.ts +++ b/apps/discord-bot/src/lib/command.listener.ts @@ -75,7 +75,7 @@ export class CommandListener extends AbstractCommandListener { guild: interaction.getGuildId() ?? null, }); - const user = await this.apiService.getUser(id); + const user = await this.apiService.getUser(id).catch(() => null); Sentry.setUser({ id, diff --git a/apps/support-bot/src/lib/command.listener.ts b/apps/support-bot/src/lib/command.listener.ts index e1445a37f..02a922359 100644 --- a/apps/support-bot/src/lib/command.listener.ts +++ b/apps/support-bot/src/lib/command.listener.ts @@ -57,7 +57,7 @@ export class CommandListener extends AbstractCommandListener { parentData ); - const user = await this.apiService.getUser(id); + const user = await this.apiService.getUser(id).catch(() => null); const context = new CommandContext(this, interaction, data); context.setUser(user); diff --git a/packages/api-client/src/api.service.ts b/packages/api-client/src/api.service.ts index f43108367..288668597 100644 --- a/packages/api-client/src/api.service.ts +++ b/packages/api-client/src/api.service.ts @@ -215,7 +215,10 @@ export class ApiService { public getUser(tag: string) { return this.request("/user", { tag }) .then((data) => data.user ?? null) - .catch(() => null); + .catch((err) => { + if (axios.isAxiosError(err) && (!err.response || err.response.status >= 500)) throw err; + return null; + }); } public updateUser(tag: string, update: UpdateUser) {