Skip to content

Commit

Permalink
Fix update error which should've been silent
Browse files Browse the repository at this point in the history
  • Loading branch information
abbyfour committed Nov 10, 2023
1 parent 6b644e1 commit 765bbc2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/helpers/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,9 @@ export function parseError(error: RawLastFMErrorResponse): string {
return error.message;
}
}

export function silentFail(func: () => any) {
try {
func();
} catch {}
}
3 changes: 2 additions & 1 deletion src/lib/command/Command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import config from "../../../config.json";
import { AnalyticsCollector } from "../../analytics/AnalyticsCollector";
import { ClientError, UnknownError } from "../../errors/errors";
import { GuildRequiredError } from "../../errors/gowon";
import { silentFail } from "../../helpers/error";
import { SimpleMap } from "../../helpers/types";
import { DiscordService } from "../../services/Discord/DiscordService";
import {
Expand Down Expand Up @@ -534,7 +535,7 @@ export abstract class Command<ArgumentsType extends ArgumentsMap = {}> {
);

if (senderUser) {
this.lilacUsersService.update(this.ctx, senderUser);
silentFail(() => this.lilacUsersService.update(this.ctx, senderUser));

try {
await this.lilacGuildsService.addUser(
Expand Down

0 comments on commit 765bbc2

Please sign in to comment.