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

feature/default_network_editable
Brad Decker 4 years ago committed by Mark Stacey
parent a492a5b0d1
commit 1aa6d7bfea
  1. 8
      app/scripts/controllers/metametrics.js

@ -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()
} }

Loading…
Cancel
Save