A Metamask fork with Infura removed and default networks editable
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
ciphermask/app/scripts/lib/cleanErrorStack.js

24 lines
542 B

/**
* Returns error without stack trace for better UI display
* @param {Error} err - error
* @returns {Error} - Error with clean stack trace.
*/
function cleanErrorStack (err) {
let name = err.name
name = (name === undefined) ? 'Error' : String(name)
let msg = err.message
msg = (msg === undefined) ? '' : String(msg)
if (name === '') {
err.stack = err.message
} else if (msg === '') {
err.stack = err.name
} else {
err.stack = err.name + ': ' + err.message
}
return err
}
export default cleanErrorStack