1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00

Ensure that metametrics error related to anonymousId is not sent to sentry (#12763)

This commit is contained in:
Dan J Miller 2021-11-19 14:07:50 -03:30 committed by GitHub
parent d89e5336a6
commit c9baf39c4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,6 +15,10 @@ const defaultCaptureException = (err) => {
});
};
const exceptionsToFilter = {
[`You must pass either an "anonymousId" or a "userId".`]: true,
};
/**
* @typedef {import('../../../shared/constants/metametrics').MetaMetricsContext} MetaMetricsContext
* @typedef {import('../../../shared/constants/metametrics').MetaMetricsEventPayload} MetaMetricsEventPayload
@ -61,7 +65,13 @@ export default class MetaMetricsController {
initState,
captureException = defaultCaptureException,
}) {
this._captureException = captureException;
this._captureException = (err) => {
// This is a temporary measure. Currently there are errors flooding sentry due to a problem in how we are tracking anonymousId
// We intend on removing this as soon as we understand how to correctly solve that problem.
if (!exceptionsToFilter[err.message]) {
captureException(err);
}
};
const prefState = preferencesStore.getState();
this.chainId = getCurrentChainId();
this.network = getNetworkIdentifier();