mirror of https://github.com/status-im/web3.js.git
Add error handling to synchronous methods (obligatory warning against using synchronous calls at all).
This commit is contained in:
parent
b064eaba20
commit
2ca4240bb7
|
@ -48,7 +48,16 @@ HttpProvider.prototype.send = function (payload) {
|
||||||
//if (request.status !== 200) {
|
//if (request.status !== 200) {
|
||||||
//return;
|
//return;
|
||||||
//}
|
//}
|
||||||
return JSON.parse(request.responseText);
|
|
||||||
|
var result = request.responseText;
|
||||||
|
|
||||||
|
try {
|
||||||
|
result = JSON.parse(result);
|
||||||
|
} catch(e) {
|
||||||
|
throw errors.InvalidResponse(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
HttpProvider.prototype.sendAsync = function (payload, callback) {
|
HttpProvider.prototype.sendAsync = function (payload, callback) {
|
||||||
|
|
Loading…
Reference in New Issue