1
0
mirror of https://github.com/XFox111/TabsAsideExtension.git synced 2026-04-22 07:58:01 +03:00

hotfix: wrapped analytics into try/catch to prevent failing on firefox

This commit is contained in:
2025-05-07 00:03:43 +03:00
parent f5bf0db039
commit 8b77159abe
10 changed files with 43 additions and 18 deletions
+1
View File
@@ -1,2 +1,3 @@
export { default as userPropertiesStorage } from "./utils/userPropertiesStorage";
export { default as trackError } from "./utils/trackError";
export { default as track } from "./utils/track";
+11
View File
@@ -0,0 +1,11 @@
export default function track(eventName: string, eventProperties?: Record<string, string>): void
{
try
{
analytics.track(eventName, eventProperties);
}
catch (ex)
{
console.error("Failed to send analytics event", ex);
}
}
+12 -5
View File
@@ -1,8 +1,15 @@
export default function trackError(name: string, error: Error): void
{
analytics.track(name, {
name: error.name,
message: error.message,
stack: error.stack ?? "no_stack"
});
try
{
analytics.track(name, {
name: error.name,
message: error.message,
stack: error.stack ?? "no_stack"
});
}
catch (ex)
{
console.error("Failed to send error report", ex);
}
}
@@ -1,5 +1,6 @@
import { useTheme } from "@/contexts/ThemeProvider";
import { v3blogPost } from "@/data/links";
import { track } from "@/features/analytics";
import extLink from "@/utils/extLink";
import * as fui from "@fluentui/react-components";
@@ -41,7 +42,7 @@ export default function WelcomeDialog(): React.ReactElement
<fui.DialogTrigger disableButtonEnhancement>
<fui.Button
appearance="primary" as="a" { ...extLink(v3blogPost) }
onClick={ () => analytics.track("visit_blog_button_click") }
onClick={ () => track("visit_blog_button_click") }
>
{ i18n.t("features.v3welcome.actions.visit_blog") }
</fui.Button>