Better error log reporting & handling (#4128)

This commit is contained in:
Jaco Greeff 2017-01-11 17:02:39 +01:00 committed by GitHub
parent b54709605a
commit 32dbf9958e
3 changed files with 29 additions and 4 deletions

View File

@ -248,18 +248,32 @@ export default class Contract {
.call(callParams)
.then((encoded) => func.decodeOutput(encoded))
.then((tokens) => tokens.map((token) => token.value))
.then((returns) => returns.length === 1 ? returns[0] : returns);
.then((returns) => returns.length === 1 ? returns[0] : returns)
.catch((error) => {
console.warn(`${func.name}.call`, values, error);
throw error;
});
};
if (!func.constant) {
func.postTransaction = (options, values = []) => {
const _options = this._encodeOptions(func, this._addOptionsTo(options), values);
return this._api.parity.postTransaction(_options);
return this._api.parity
.postTransaction(_options)
.catch((error) => {
console.warn(`${func.name}.postTransaction`, values, error);
throw error;
});
};
func.estimateGas = (options, values = []) => {
const _options = this._encodeOptions(func, this._addOptionsTo(options), values);
return this._api.eth.estimateGas(_options);
return this._api.eth
.estimateGas(_options)
.catch((error) => {
console.warn(`${func.name}.estimateGas`, values, error);
throw error;
});
};
}
@ -385,6 +399,10 @@ export default class Contract {
this._subscribeToChanges();
return subscriptionId;
});
})
.catch((error) => {
console.warn('subscribe', event, _options, error);
throw error;
});
}

View File

@ -75,6 +75,9 @@ export function personalAccountsInfo (accountsInfo) {
return wallet;
});
})
.catch(() => {
return [];
})
.then((_wallets) => {
_wallets.forEach((wallet) => {
const owners = wallet.owners.map((o) => o.address);
@ -96,6 +99,10 @@ export function personalAccountsInfo (accountsInfo) {
dispatch(_personalAccountsInfo(data));
dispatch(attachWallets(wallets));
dispatch(fetchBalances());
})
.catch((error) => {
console.warn('personalAccountsInfo', error);
throw error;
});
};
}

View File

@ -256,7 +256,7 @@ export default class DappsStore {
store.set(LS_KEY_DISPLAY, this.displayApps);
}
@action addApps = (_apps) => {
@action addApps = (_apps = []) => {
transaction(() => {
const apps = _apps.filter((app) => app);