fix: Remove try/catch statements without error argument (#6370)

This commit is contained in:
Tom Moor
2024-01-10 08:02:44 -08:00
committed by GitHub
parent 870c623601
commit 22c52f84c5
5 changed files with 8 additions and 8 deletions

View File

@@ -93,7 +93,7 @@ export default class UsersStore extends Store<User> {
try { try {
this.updateCounts(UserRole.Admin, user.role); this.updateCounts(UserRole.Admin, user.role);
await this.actionOnUser("promote", user); await this.actionOnUser("promote", user);
} catch { } catch (_e) {
this.updateCounts(user.role, UserRole.Admin); this.updateCounts(user.role, UserRole.Admin);
} }
}; };
@@ -103,7 +103,7 @@ export default class UsersStore extends Store<User> {
try { try {
this.updateCounts(to, user.role); this.updateCounts(to, user.role);
await this.actionOnUser("demote", user, to); await this.actionOnUser("demote", user, to);
} catch { } catch (_e) {
this.updateCounts(user.role, to); this.updateCounts(user.role, to);
} }
}; };
@@ -114,7 +114,7 @@ export default class UsersStore extends Store<User> {
this.counts.suspended += 1; this.counts.suspended += 1;
this.counts.active -= 1; this.counts.active -= 1;
await this.actionOnUser("suspend", user); await this.actionOnUser("suspend", user);
} catch { } catch (_e) {
this.counts.suspended -= 1; this.counts.suspended -= 1;
this.counts.active += 1; this.counts.active += 1;
} }
@@ -126,7 +126,7 @@ export default class UsersStore extends Store<User> {
this.counts.suspended -= 1; this.counts.suspended -= 1;
this.counts.active += 1; this.counts.active += 1;
await this.actionOnUser("activate", user); await this.actionOnUser("activate", user);
} catch { } catch (_e) {
this.counts.suspended += 1; this.counts.suspended += 1;
this.counts.active -= 1; this.counts.active -= 1;
} }

View File

@@ -98,7 +98,7 @@ export default class TextHelper {
// Skip attempting to fetch images that are not valid urls // Skip attempting to fetch images that are not valid urls
try { try {
new URL(image.src); new URL(image.src);
} catch { } catch (_e) {
return; return;
} }

View File

@@ -15,7 +15,7 @@ export const ProsemirrorSchema = z.custom<TProsemirrorData>((val) => {
const node = Node.fromJSON(schema, val); const node = Node.fromJSON(schema, val);
node.check(); node.check();
return true; return true;
} catch { } catch (_e) {
return false; return false;
} }
}, "not valid data"); }, "not valid data");

View File

@@ -10,7 +10,7 @@ function YouTube({ matches, ...props }: Props) {
const url = new URL(props.attrs.href); const url = new URL(props.attrs.href);
const searchParams = new URLSearchParams(url.search); const searchParams = new URLSearchParams(url.search);
start = searchParams.get("t")?.replace(/s$/, ""); start = searchParams.get("t")?.replace(/s$/, "");
} catch { } catch (_e) {
// noop // noop
} }

View File

@@ -92,7 +92,7 @@ export default class FileHelper {
height: idhrData.height / pixelRatio, height: idhrData.height / pixelRatio,
}; };
} }
} catch { } catch (_e) {
return undefined; return undefined;
} }