mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 18:00:18 +01:00
e28db07a1b
* Set sentry autoTrackSessions default * endSession.... * fixup * updated comment * prevent breaking devmode * remove changes to beforeSend * remove additional usage of sinon
30 lines
906 B
JavaScript
30 lines
906 B
JavaScript
import setupSentry from './lib/setupSentry';
|
|
|
|
// The root compartment will populate this with hooks
|
|
global.stateHooks = {};
|
|
|
|
// setup sentry error reporting
|
|
global.sentry = setupSentry({
|
|
release: process.env.METAMASK_VERSION,
|
|
getState: () => global.stateHooks?.getSentryState?.() || {},
|
|
});
|
|
|
|
/**
|
|
* As soon as state is available via getSentryState we can call the
|
|
* toggleSession method added to sentry in setupSentry to start automatic
|
|
* session tracking.
|
|
*/
|
|
function waitForStateHooks() {
|
|
if (global.stateHooks.getSentryState) {
|
|
// sentry is not defined in dev mode, so if sentry doesn't exist at this
|
|
// point it means that we are in dev mode and do not need to toggle the
|
|
// session. Using optional chaining is sufficient to prevent the error in
|
|
// development.
|
|
global.sentry?.toggleSession();
|
|
} else {
|
|
setTimeout(waitForStateHooks, 100);
|
|
}
|
|
}
|
|
|
|
waitForStateHooks();
|