perf: dynamic import for sentry CaptureException (#19730)

This commit is contained in:
Benny Joo
2025-03-04 23:07:20 +00:00
committed by GitHub
parent 11267e9359
commit 65898f29eb
3 changed files with 7 additions and 6 deletions
@@ -1,5 +1,3 @@
import { captureException } from "@sentry/nextjs";
import db from "@calcom/prisma";
import type { AppFlags } from "./config";
@@ -11,6 +9,7 @@ export class FeaturesRepository implements IFeaturesRepository {
try {
return await getFeatureFlag(db, slug);
} catch (err) {
const captureException = (await import("@sentry/nextjs")).captureException;
captureException(err);
throw err;
}
@@ -35,6 +34,7 @@ export class FeaturesRepository implements IFeaturesRepository {
if (userBelongsToTeamWithFeature) return true;
return false;
} catch (err) {
const captureException = (await import("@sentry/nextjs")).captureException;
captureException(err);
throw err;
}
@@ -61,6 +61,7 @@ export class FeaturesRepository implements IFeaturesRepository {
if (user) return true;
return false;
} catch (err) {
const captureException = (await import("@sentry/nextjs")).captureException;
captureException(err);
throw err;
}
@@ -72,6 +73,7 @@ export class FeaturesRepository implements IFeaturesRepository {
});
return !!teamFeature;
} catch (err) {
const captureException = (await import("@sentry/nextjs")).captureException;
captureException(err);
throw err;
}
+1 -2
View File
@@ -1,5 +1,3 @@
import { captureException } from "@sentry/nextjs";
import db from "@calcom/prisma";
import type { IUsersRepository } from "./users.repository.interface";
@@ -13,6 +11,7 @@ export class UsersRepository implements IUsersRepository {
});
return user;
} catch (err) {
const captureException = (await import("@sentry/nextjs")).captureException;
captureException(err);
throw err;
}
@@ -1,5 +1,3 @@
import { captureException } from "@sentry/nextjs";
import db from "@calcom/prisma";
import { WatchlistType, WatchlistSeverity } from "@calcom/prisma/enums";
@@ -20,6 +18,7 @@ export class WatchlistRepository implements IWatchlistRepository {
});
return emailInWatchlist;
} catch (err) {
const captureException = (await import("@sentry/nextjs")).captureException;
captureException(err);
throw err;
}
@@ -35,6 +34,7 @@ export class WatchlistRepository implements IWatchlistRepository {
});
return domainInWatchWatchlist;
} catch (err) {
const captureException = (await import("@sentry/nextjs")).captureException;
captureException(err);
throw err;
}