1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00

throw a new wrapped error instead of default one from segment (#10118)

This commit is contained in:
Brad Decker 2020-12-22 21:54:49 -06:00 committed by GitHub
parent 2f6f8966bb
commit 64adcae08d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -265,7 +265,13 @@ export default class MetaMetricsController {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const callback = (err) => { const callback = (err) => {
if (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() return resolve()
} }