Add missing onError callbacks

This commit is contained in:
Fabio Berger
2018-01-18 15:02:36 +08:00
parent eb0d7df50b
commit 996e9e9102
2 changed files with 10 additions and 2 deletions

View File

@@ -375,7 +375,11 @@ export class Blockchain {
clearInterval(this._zrxPollIntervalId);
delete this._zrxPollIntervalId;
}
}, 5000);
}, 5000, (err: Error) => {
utils.consoleLog(`Polling tokenBalance failed: ${err}`);
clearInterval(this._zrxPollIntervalId);
delete this._zrxPollIntervalId;
});
}
public async signOrderHashAsync(orderHash: string): Promise<SignatureData> {
utils.assert(!_.isUndefined(this._zeroEx), 'ZeroEx must be instantiated.');

View File

@@ -1,6 +1,7 @@
import { BigNumber, intervalUtils, promisify } from '@0xproject/utils';
import * as _ from 'lodash';
import { Dispatcher } from 'ts/redux/dispatcher';
import { utils } from 'ts/utils/utils';
import * as Web3 from 'web3';
export class Web3Wrapper {
@@ -135,7 +136,10 @@ export class Web3Wrapper {
await this._updateUserEtherBalanceAsync(this._prevUserAddress);
}
}
}, 5000);
}, 5000, (err: Error) => {
utils.consoleLog(`Watching network and balances failed: ${err}`);
this._stopEmittingNetworkConnectionAndUserBalanceStateAsync();
});
}
private async _updateUserEtherBalanceAsync(userAddress: string) {
const balance = await this.getBalanceInEthAsync(userAddress);