1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-24 19:10:22 +01:00
metamask-extension/types/global.d.ts
Dan J Miller b874a301f5
Capture exception with sentry when invariant conditions are met in migrations (#20427)
* capture exception for sentry when invariant conditions are met in migration 82

* Code cleanup

* Capture exceptions in invariant conditions for migrations 83,84,85,86,89,91,93,94

* Update app/scripts/migrations/082.test.js

Co-authored-by: Mark Stacey <markjstacey@gmail.com>

* Code cleanup

* Fix SentryObject type declaration

* Stop throwing error if preferences controller is undefined

* Refactor 084 and 086 to remove double negative

* Capture exceptions for invariant states in in migrations 87,88,90 and 92

* lint fix

* log warning in migration 82 when preferences controller is undefined

---------

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2023-08-16 16:56:20 -02:30

37 lines
1.1 KiB
TypeScript

// In order for variables to be considered on the global scope they must be
// declared using var and not const or let, which is why this rule is disabled
/* eslint-disable no-var */
import * as Sentry from '@sentry/browser';
declare class Platform {
openTab: (opts: { url: string }) => void;
closeCurrentWindow: () => void;
}
type SentryObject = Sentry & {
// Verifies that the user has opted into metrics and then updates the sentry
// instance to track sessions and begins the session.
startSession: () => void;
// Verifies that the user has opted out of metrics and then updates the
// sentry instance to NOT track sessions and ends the current session.
endSession: () => void;
// Calls either startSession or endSession based on optin status
toggleSession: () => void;
};
export declare global {
var platform: Platform;
// Sentry is undefined in dev, so use optional chaining
var sentry: SentryObject | undefined;
namespace jest {
interface Matchers<R> {
toBeFulfilled(): Promise<R>;
toNeverResolve(): Promise<R>;
}
}
}