-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Paul Mineev
committed
Nov 9, 2024
1 parent
4efe564
commit 02da7d5
Showing
4 changed files
with
49 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
export function initSentry() { | ||
const Sentry = import('@sentry/browser'); | ||
Sentry.init({ | ||
dsn: 'https://[email protected]/1467904', | ||
}); | ||
return Sentry; | ||
} | ||
let Sentry; | ||
|
||
/** Lazy load Sentry on error */ | ||
async function handleException(errorEvent) { | ||
try { | ||
if (Sentry === undefined) { | ||
Sentry = await import('@sentry/browser'); | ||
Sentry.init({ | ||
dsn: 'https://[email protected]/4508265848897536', | ||
enabled: process.env.NODE_ENV === 'production' || process.env.ENABLE_SENTRY, | ||
}); | ||
} | ||
Sentry.captureException(errorEvent); | ||
} catch (e) { | ||
console.error('Logging to Sentry failed', e); | ||
} | ||
} | ||
|
||
window.addEventListener('error', handleException); | ||
window.addEventListener('unhandledrejection', handleException); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters