fix: Sentry.configureScope silently throwing error

This commit is contained in:
Tom Moor committed 2024-11-06 21:33:13 -05:00
1 parent 62ee075a6f
commit c57b845093
1 file changed
+12 -10
+12 -10
View File
@@ -218,19 +218,13 @@ export default class AuthStore extends Store<Team> {
this.collaborationToken = res.data.collaborationToken;
if (env.SENTRY_DSN) {
Sentry.configureScope(function (scope) {
scope.setUser({ id: this.currentUserId });
scope.setExtra("team", this.team.name);
scope.setExtra("teamId", this.team.id);
Sentry.configureScope((scope) => {
scope.setUser({ id: this.currentUserId! });
scope.setExtra("team", this.team?.name);
scope.setExtra("teamId", this.currentTeamId);
});
}
const currTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
if (data.user.timezone !== currTimezone) {
const user = this.rootStore.users.get(data.user.id)!;
void user.save({ timezone: currTimezone });
}
// Redirect to the correct custom domain or team subdomain if needed
// Occurs when the (sub)domain is changed in admin and the user hits an old url
const { hostname, pathname } = window.location;
@@ -247,6 +241,13 @@ export default class AuthStore extends Store<Team> {
window.location.href = `${data.team.url}${pathname}`;
return;
}
// Update the user's timezone if it has changed
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
if (data.user.timezone !== timezone) {
const user = this.rootStore.users.get(data.user.id)!;
void user.save({ timezone });
}
});
} catch (err) {
if (err.error === "user_suspended") {
@@ -254,6 +255,7 @@ export default class AuthStore extends Store<Team> {
this.suspendedContactEmail = err.data.adminEmail;
return;
}
throw err;
} finally {
this.isFetching = false;
}