mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
Handle Promise rejections when importing accounts (#4142)
* Silently catch import failures since errors exist in Redux state * Add comment about no-op catch statement
This commit is contained in:
parent
a93237a4cd
commit
5ec631cad3
@ -70,10 +70,14 @@ class ImportAccountScreen extends Component {
|
||||
switch (this.state.selectedOption) {
|
||||
case OPTIONS.JSON_FILE:
|
||||
return importNewAccount('JSON File', [ jsonFile, password ])
|
||||
// JS runtime requires caught rejections but failures are handled by Redux
|
||||
.catch()
|
||||
.then(next)
|
||||
case OPTIONS.PRIVATE_KEY:
|
||||
default:
|
||||
return importNewAccount('Private Key', [ privateKey ])
|
||||
// JS runtime requires caught rejections but failures are handled by Redux
|
||||
.catch()
|
||||
.then(next)
|
||||
}
|
||||
}
|
||||
|
@ -96,6 +96,8 @@ class JsonImportSubview extends Component {
|
||||
}
|
||||
|
||||
this.props.importNewAccount([ fileContents, password ])
|
||||
// JS runtime requires caught rejections but failures are handled by Redux
|
||||
.catch()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,4 +64,6 @@ PrivateKeyImportView.prototype.createNewKeychain = function () {
|
||||
const input = document.getElementById('private-key-box')
|
||||
const privateKey = input.value
|
||||
this.props.dispatch(actions.importNewAccount('Private Key', [ privateKey ]))
|
||||
// JS runtime requires caught rejections but failures are handled by Redux
|
||||
.catch()
|
||||
}
|
||||
|
@ -105,6 +105,8 @@ class JsonImportSubview extends Component {
|
||||
}
|
||||
|
||||
this.props.importNewJsonAccount([ fileContents, password ])
|
||||
// JS runtime requires caught rejections but failures are handled by Redux
|
||||
.catch()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,5 +91,7 @@ PrivateKeyImportView.prototype.createNewKeychain = function () {
|
||||
const { importNewAccount, history } = this.props
|
||||
|
||||
importNewAccount('Private Key', [ privateKey ])
|
||||
// JS runtime requires caught rejections but failures are handled by Redux
|
||||
.catch()
|
||||
.then(() => history.push(DEFAULT_ROUTE))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user