From 22c52f84c56f15f08d0ec8d667ad4851e4542343 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 10 Jan 2024 08:02:44 -0800 Subject: [PATCH] fix: Remove try/catch statements without error argument (#6370) --- app/stores/UsersStore.ts | 8 ++++---- server/models/helpers/TextHelper.ts | 2 +- server/routes/api/schema.ts | 2 +- shared/editor/embeds/YouTube.tsx | 2 +- shared/editor/lib/FileHelper.ts | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/stores/UsersStore.ts b/app/stores/UsersStore.ts index 619c64e06..dad596522 100644 --- a/app/stores/UsersStore.ts +++ b/app/stores/UsersStore.ts @@ -93,7 +93,7 @@ export default class UsersStore extends Store { try { this.updateCounts(UserRole.Admin, user.role); await this.actionOnUser("promote", user); - } catch { + } catch (_e) { this.updateCounts(user.role, UserRole.Admin); } }; @@ -103,7 +103,7 @@ export default class UsersStore extends Store { try { this.updateCounts(to, user.role); await this.actionOnUser("demote", user, to); - } catch { + } catch (_e) { this.updateCounts(user.role, to); } }; @@ -114,7 +114,7 @@ export default class UsersStore extends Store { this.counts.suspended += 1; this.counts.active -= 1; await this.actionOnUser("suspend", user); - } catch { + } catch (_e) { this.counts.suspended -= 1; this.counts.active += 1; } @@ -126,7 +126,7 @@ export default class UsersStore extends Store { this.counts.suspended -= 1; this.counts.active += 1; await this.actionOnUser("activate", user); - } catch { + } catch (_e) { this.counts.suspended += 1; this.counts.active -= 1; } diff --git a/server/models/helpers/TextHelper.ts b/server/models/helpers/TextHelper.ts index 2b7b3172e..bb28301be 100644 --- a/server/models/helpers/TextHelper.ts +++ b/server/models/helpers/TextHelper.ts @@ -98,7 +98,7 @@ export default class TextHelper { // Skip attempting to fetch images that are not valid urls try { new URL(image.src); - } catch { + } catch (_e) { return; } diff --git a/server/routes/api/schema.ts b/server/routes/api/schema.ts index ec9e16826..a22393216 100644 --- a/server/routes/api/schema.ts +++ b/server/routes/api/schema.ts @@ -15,7 +15,7 @@ export const ProsemirrorSchema = z.custom((val) => { const node = Node.fromJSON(schema, val); node.check(); return true; - } catch { + } catch (_e) { return false; } }, "not valid data"); diff --git a/shared/editor/embeds/YouTube.tsx b/shared/editor/embeds/YouTube.tsx index fd1fca82f..00a8fdad2 100644 --- a/shared/editor/embeds/YouTube.tsx +++ b/shared/editor/embeds/YouTube.tsx @@ -10,7 +10,7 @@ function YouTube({ matches, ...props }: Props) { const url = new URL(props.attrs.href); const searchParams = new URLSearchParams(url.search); start = searchParams.get("t")?.replace(/s$/, ""); - } catch { + } catch (_e) { // noop } diff --git a/shared/editor/lib/FileHelper.ts b/shared/editor/lib/FileHelper.ts index 4ab69da3b..0e127c592 100644 --- a/shared/editor/lib/FileHelper.ts +++ b/shared/editor/lib/FileHelper.ts @@ -92,7 +92,7 @@ export default class FileHelper { height: idhrData.height / pixelRatio, }; } - } catch { + } catch (_e) { return undefined; }