mirror of https://github.com/status-im/web3.js.git
picked watch change2
This commit is contained in:
parent
2215e7c3af
commit
56d13f72fb
|
@ -1625,6 +1625,9 @@ var utils = require('../utils/utils');
|
|||
|
||||
module.exports = {
|
||||
InvalidNumberOfParams: new Error('Invalid number of input parameters'),
|
||||
NoConnection: function(host){
|
||||
return new Error('CONNECTION ERROR: Couldn\'t connect to node '+ host +', is it running?');
|
||||
},
|
||||
InvalidProvider: new Error('Providor not set or invalid'),
|
||||
InvalidResponse: function(result){
|
||||
var message = 'Invalid JSON RPC response';
|
||||
|
@ -2404,6 +2407,7 @@ module.exports = {
|
|||
"use strict";
|
||||
|
||||
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; // jshint ignore:line
|
||||
var errors = require('./errors');
|
||||
|
||||
var HttpProvider = function (host) {
|
||||
this.host = host || 'http://localhost:8080';
|
||||
|
@ -2413,7 +2417,13 @@ HttpProvider.prototype.send = function (payload) {
|
|||
var request = new XMLHttpRequest();
|
||||
|
||||
request.open('POST', this.host, false);
|
||||
request.send(JSON.stringify(payload));
|
||||
|
||||
try {
|
||||
request.send(JSON.stringify(payload));
|
||||
} catch(error) {
|
||||
throw errors.NoConnection(this.host);
|
||||
}
|
||||
|
||||
|
||||
// check request.status
|
||||
// TODO: throw an error here! it cannot silently fail!!!
|
||||
|
@ -2433,13 +2443,18 @@ HttpProvider.prototype.sendAsync = function (payload, callback) {
|
|||
};
|
||||
|
||||
request.open('POST', this.host, true);
|
||||
request.send(JSON.stringify(payload));
|
||||
|
||||
try {
|
||||
request.send(JSON.stringify(payload));
|
||||
} catch(error) {
|
||||
throw errors.NoConnection(this.host);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = HttpProvider;
|
||||
|
||||
|
||||
},{"xmlhttprequest":5}],18:[function(require,module,exports){
|
||||
},{"./errors":12,"xmlhttprequest":5}],18:[function(require,module,exports){
|
||||
/*
|
||||
This file is part of ethereum.js.
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1625,6 +1625,9 @@ var utils = require('../utils/utils');
|
|||
|
||||
module.exports = {
|
||||
InvalidNumberOfParams: new Error('Invalid number of input parameters'),
|
||||
NoConnection: function(host){
|
||||
return new Error('CONNECTION ERROR: Couldn\'t connect to node '+ host +', is it running?');
|
||||
},
|
||||
InvalidProvider: new Error('Providor not set or invalid'),
|
||||
InvalidResponse: function(result){
|
||||
var message = 'Invalid JSON RPC response';
|
||||
|
@ -2404,6 +2407,7 @@ module.exports = {
|
|||
"use strict";
|
||||
|
||||
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; // jshint ignore:line
|
||||
var errors = require('./errors');
|
||||
|
||||
var HttpProvider = function (host) {
|
||||
this.host = host || 'http://localhost:8080';
|
||||
|
@ -2413,7 +2417,13 @@ HttpProvider.prototype.send = function (payload) {
|
|||
var request = new XMLHttpRequest();
|
||||
|
||||
request.open('POST', this.host, false);
|
||||
request.send(JSON.stringify(payload));
|
||||
|
||||
try {
|
||||
request.send(JSON.stringify(payload));
|
||||
} catch(error) {
|
||||
throw errors.NoConnection(this.host);
|
||||
}
|
||||
|
||||
|
||||
// check request.status
|
||||
// TODO: throw an error here! it cannot silently fail!!!
|
||||
|
@ -2433,13 +2443,18 @@ HttpProvider.prototype.sendAsync = function (payload, callback) {
|
|||
};
|
||||
|
||||
request.open('POST', this.host, true);
|
||||
request.send(JSON.stringify(payload));
|
||||
|
||||
try {
|
||||
request.send(JSON.stringify(payload));
|
||||
} catch(error) {
|
||||
throw errors.NoConnection(this.host);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = HttpProvider;
|
||||
|
||||
|
||||
},{"xmlhttprequest":5}],18:[function(require,module,exports){
|
||||
},{"./errors":12,"xmlhttprequest":5}],18:[function(require,module,exports){
|
||||
/*
|
||||
This file is part of ethereum.js.
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -24,6 +24,9 @@ var utils = require('../utils/utils');
|
|||
|
||||
module.exports = {
|
||||
InvalidNumberOfParams: new Error('Invalid number of input parameters'),
|
||||
NoConnection: function(host){
|
||||
return new Error('CONNECTION ERROR: Couldn\'t connect to node '+ host +', is it running?');
|
||||
},
|
||||
InvalidProvider: new Error('Providor not set or invalid'),
|
||||
InvalidResponse: function(result){
|
||||
var message = 'Invalid JSON RPC response';
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
"use strict";
|
||||
|
||||
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; // jshint ignore:line
|
||||
var errors = require('./errors');
|
||||
|
||||
var HttpProvider = function (host) {
|
||||
this.host = host || 'http://localhost:8080';
|
||||
|
@ -34,7 +35,13 @@ HttpProvider.prototype.send = function (payload) {
|
|||
var request = new XMLHttpRequest();
|
||||
|
||||
request.open('POST', this.host, false);
|
||||
request.send(JSON.stringify(payload));
|
||||
|
||||
try {
|
||||
request.send(JSON.stringify(payload));
|
||||
} catch(error) {
|
||||
throw errors.NoConnection(this.host);
|
||||
}
|
||||
|
||||
|
||||
// check request.status
|
||||
// TODO: throw an error here! it cannot silently fail!!!
|
||||
|
@ -54,7 +61,12 @@ HttpProvider.prototype.sendAsync = function (payload, callback) {
|
|||
};
|
||||
|
||||
request.open('POST', this.host, true);
|
||||
request.send(JSON.stringify(payload));
|
||||
|
||||
try {
|
||||
request.send(JSON.stringify(payload));
|
||||
} catch(error) {
|
||||
throw errors.NoConnection(this.host);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = HttpProvider;
|
||||
|
|
Loading…
Reference in New Issue