Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

consistent error naming in catch

Oleg Isonen1f2475b9f468
diff --git a/apps/builder/app/builder/shared/client-settings/settings.ts b/apps/builder/app/builder/shared/client-settings/settings.ts
index 8177ffc038..856b77e00f 100644
--- a/apps/builder/app/builder/shared/client-settings/settings.ts
+++ b/apps/builder/app/builder/shared/client-settings/settings.ts
@@ -22,7 +22,7 @@ const read = (): Settings => {
let settingsString;
try {
settingsString = localStorage.getItem(namespace);
- } catch (_error) {
+ } catch {
// We don't need to handle this one.
}
diff --git a/apps/builder/app/entry.client.tsx b/apps/builder/app/entry.client.tsx
index 65822500b7..881f1f81ab 100644
--- a/apps/builder/app/entry.client.tsx
+++ b/apps/builder/app/entry.client.tsx
@@ -30,9 +30,9 @@ try {
) {
localStorage.debug = env.DEBUG;
}
-} catch (e) {
+} catch (error) {
// eslint-disable-next-line no-console
- console.warn("Failed to set localStorage.debug due to Error:", e);
+ console.warn("Failed to set localStorage.debug due to Error:", error);
}
hydrate(<RemixBrowser />, document);
diff --git a/apps/builder/app/routes/auth/github.tsx b/apps/builder/app/routes/auth/github.tsx
index 30a6050c5f..f8148e8ac5 100644
--- a/apps/builder/app/routes/auth/github.tsx
+++ b/apps/builder/app/routes/auth/github.tsx
@@ -17,7 +17,7 @@ export const action = async ({ request }: ActionArgs) => {
successRedirect: returnTo,
throwOnError: true,
});
- } catch (error: unknown) {
+ } catch (error) {
// all redirects are basically errors and in that case we don't want to catch it
if (error instanceof Response) {
return error;
diff --git a/apps/builder/app/routes/auth/google.tsx b/apps/builder/app/routes/auth/google.tsx
index 8c5b3a2aee..6319a331c7 100644
--- a/apps/builder/app/routes/auth/google.tsx
+++ b/apps/builder/app/routes/auth/google.tsx
@@ -19,7 +19,7 @@ export const action = async ({ request }: ActionArgs) => {
successRedirect: returnTo,
throwOnError: true,
});
- } catch (error: unknown) {
+ } catch (error) {
// all redirects are basically errors and in that case we don't want to catch it
if (error instanceof Response) {
return error;
diff --git a/apps/builder/app/routes/rest/project/clone.$domain.ts b/apps/builder/app/routes/rest/project/clone.$domain.ts
index fd1ea5ce11..dc38bb7212 100644
--- a/apps/builder/app/routes/rest/project/clone.$domain.ts
+++ b/apps/builder/app/routes/rest/project/clone.$domain.ts
@@ -52,7 +52,7 @@ export const loader = async ({ request, params }: LoaderArgs) => {
);
return redirect(builderPath({ projectId: project.id }));
- } catch (error: unknown) {
+ } catch (error) {
if (error instanceof Error) {
return { errors: error.message };
}
diff --git a/apps/builder/app/services/auth.server.ts b/apps/builder/app/services/auth.server.ts
index c3a9f0de11..a53dc17d9b 100644
--- a/apps/builder/app/services/auth.server.ts
+++ b/apps/builder/app/services/auth.server.ts
@@ -23,7 +23,7 @@ const strategyCallback = async ({
try {
const user = await db.user.createOrLoginWithOAuth(profile);
return user;
- } catch (error: unknown) {
+ } catch (error) {
if (error instanceof Error) {
sentryException({
error,
@@ -75,7 +75,7 @@ if (env.DEV_LOGIN === "true") {
try {
const user = await db.user.createOrLoginWithDev();
return user;
- } catch (error: unknown) {
+ } catch (error) {
if (error instanceof Error) {
sentryException({
error,
diff --git a/packages/feature-flags/src/feature.ts b/packages/feature-flags/src/feature.ts
index ecc905fe41..081c2ef356 100644
--- a/packages/feature-flags/src/feature.ts
+++ b/packages/feature-flags/src/feature.ts
@@ -12,7 +12,7 @@ const readLocal = (): Array<Name> => {
try {
const flags = localStorage.getItem("features");
return parse(flags);
- } catch (_error) {
+ } catch {
// Not having feature in localStorage or not having localStorage implemented, both should not throw.
}
return [];
diff --git a/packages/prisma-client/migrations-cli/commands.ts b/packages/prisma-client/migrations-cli/commands.ts
index d6f8099406..fb85896796 100644
--- a/packages/prisma-client/migrations-cli/commands.ts
+++ b/packages/prisma-client/migrations-cli/commands.ts
@@ -244,7 +244,7 @@ const up = async () => {
if (locker) {
try {
await locker.getLock();
- } catch (e) {
+ } catch (error) {
throw new UserError(
`Could not acquire lock!
This means that another process is already running migrations.
@@ -256,8 +256,8 @@ If you're sure no other process is running, please delete the lockfile:
try {
await umzug.up();
- } catch (err) {
- const originalError: unknown = err.cause || err;
+ } catch (error) {
+ const originalError: unknown = error.cause || error;
const originalErrorString =
(originalError instanceof Error && originalError.stack) ||
inspect(originalError);
@@ -266,7 +266,7 @@ If you're sure no other process is running, please delete the lockfile:
logger.error(originalErrorString);
logger.error("");
- const migrationName = (err.migration || undefined)?.name;
+ const migrationName = (error.migration || undefined)?.name;
if (typeof migrationName === "string") {
prismaMigrations.setFailed(migrationName, originalErrorString);
}
diff --git a/packages/trpc-interface/src/trpc-caller-link.ts b/packages/trpc-interface/src/trpc-caller-link.ts
index 8d8886651d..e2447647b5 100644
--- a/packages/trpc-interface/src/trpc-caller-link.ts
+++ b/packages/trpc-interface/src/trpc-caller-link.ts
@@ -48,7 +48,7 @@ export const callerLink = <TemplateRouter extends AnyRouter>(
});
observer.complete();
})
- .catch((cause) => observer.error(TRPCClientError.from(cause)));
+ .catch((error) => observer.error(TRPCClientError.from(error)));
return () => {
// nothing to cancel