Skip to content

Commit

Permalink
Handle empty identity, handle error on removing of previosly deleted …
Browse files Browse the repository at this point in the history
…keyring acc, correct handle of error if it is an object
  • Loading branch information
vbaranov committed Nov 13, 2018
1 parent af587d9 commit a33ba78
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 5 additions & 1 deletion app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,11 @@ module.exports = class MetamaskController extends EventEmitter {
this.accountTracker.removeAccount([address])

// Remove account from the keyring
await this.keyringController.removeAccount(address)
try {
await this.keyringController.removeAccount(address)
} catch (e) {
log.error(e)
}
return address
}

Expand Down
3 changes: 3 additions & 0 deletions old-ui/app/components/account-dropdowns.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ class AccountDropdowns extends Component {

return accountOrder.map((address, index) => {
const identity = identities[address]
if (!identity) {
return null
}
const isSelected = identity.address === selected

const simpleAddress = identity.address.substring(2).toLowerCase()
Expand Down
6 changes: 3 additions & 3 deletions old-ui/app/components/connect-hardware/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class ConnectHardwareForm extends Component {
if (e === 'Window blocked') {
this.setState({ browserSupported: false, error: null})
} else if (e !== 'Window closed') {
this.setState({ error: e.toString() })
this.setState({ error: (e.message || e.toString()) })
}
})
}
Expand All @@ -140,7 +140,7 @@ class ConnectHardwareForm extends Component {
unlocked: false,
})
}).catch(e => {
this.setState({ error: e.toString() })
this.setState({ error: (e.message || e.toString()) })
})
}

Expand All @@ -154,7 +154,7 @@ class ConnectHardwareForm extends Component {
.then(_ => {
this.props.goHome()
}).catch(e => {
this.setState({ error: e.toString() })
this.setState({ error: (e.message || e.toString()) })
})
}

Expand Down

0 comments on commit a33ba78

Please sign in to comment.