From 64adcae08deda6b9c5dba3c7e550c2ce32fadde6 Mon Sep 17 00:00:00 2001 From: Brad Decker Date: Tue, 22 Dec 2020 21:54:49 -0600 Subject: [PATCH] throw a new wrapped error instead of default one from segment (#10118) --- app/scripts/controllers/metametrics.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/scripts/controllers/metametrics.js b/app/scripts/controllers/metametrics.js index c995ea491..3ae74cbf8 100644 --- a/app/scripts/controllers/metametrics.js +++ b/app/scripts/controllers/metametrics.js @@ -265,7 +265,13 @@ export default class MetaMetricsController { return new Promise((resolve, reject) => { const callback = (err) => { if (err) { - return reject(err) + // The error that segment gives us has some manipulation done to it + // that seemingly breaks with lockdown enabled. Creating a new error + // here prevents the system from freezing when the network request to + // segment fails for any reason. + const safeError = new Error(err.message) + safeError.stack = err.stack + return reject(safeError) } return resolve() }