Added error handling to header
This commit is contained in:
parent
e0764db85d
commit
d1b1784e4d
@ -92,7 +92,8 @@ class App extends Component {
|
|||||||
accounts={this.state.accounts}
|
accounts={this.state.accounts}
|
||||||
balance={this.state.balance}
|
balance={this.state.balance}
|
||||||
error={this.state.error}
|
error={this.state.error}
|
||||||
onAfterUserUpdate={(e) => this._loadCurrentUser()} />
|
onAfterUserUpdate={(e) => this._loadCurrentUser()}
|
||||||
|
onError={(err, source) => this._onError(err, source)} />
|
||||||
<Main
|
<Main
|
||||||
user={this.state.user}
|
user={this.state.user}
|
||||||
account={this.state.account}
|
account={this.state.account}
|
||||||
|
@ -75,7 +75,7 @@ class Header extends Component {
|
|||||||
*/
|
*/
|
||||||
_initUserAccounts = async () => {
|
_initUserAccounts = async () => {
|
||||||
await map(this.props.accounts, async function (address, next) {
|
await map(this.props.accounts, async function (address, next) {
|
||||||
|
try {
|
||||||
// gets the balance of the address
|
// gets the balance of the address
|
||||||
const balance = await web3.eth.getBalance(address);
|
const balance = await web3.eth.getBalance(address);
|
||||||
|
|
||||||
@ -94,7 +94,12 @@ class Header extends Component {
|
|||||||
user: user,
|
user: user,
|
||||||
balance: web3.utils.fromWei(balance, 'ether')
|
balance: web3.utils.fromWei(balance, 'ether')
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
next(err);
|
||||||
|
}
|
||||||
}, (err, userAccounts) => {
|
}, (err, userAccounts) => {
|
||||||
|
if(err) return this.props.onError(err, 'Header._initUserAccounts');
|
||||||
this.setState({ userAccounts: userAccounts })
|
this.setState({ userAccounts: userAccounts })
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -274,7 +279,7 @@ class Header extends Component {
|
|||||||
</Dropdown.Menu>
|
</Dropdown.Menu>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
</ButtonToolbar>
|
</ButtonToolbar>
|
||||||
{ isEditable ? states.tweet : '' }
|
{isEditable ? states.tweet : ''}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user