mirror of
https://github.com/status-im/web3.js.git
synced 2025-02-23 19:48:13 +00:00
added better error reporting for subscription errors
This commit is contained in:
parent
ba43098215
commit
bf8f3b014a
@ -168,8 +168,7 @@ Method.prototype._confirmTransaction = function (defer, result, payload, extraFo
|
||||
isContractDeployment = _.isObject(payload.params[0]) &&
|
||||
payload.params[0].data &&
|
||||
payload.params[0].from &&
|
||||
!payload.params[0].to,
|
||||
receiptError = 'Failed to check for transaction receipt:';
|
||||
!payload.params[0].to;
|
||||
|
||||
|
||||
// fire "receipt" and confirmation events and resolve after
|
||||
@ -181,7 +180,7 @@ Method.prototype._confirmTransaction = function (defer, result, payload, extraFo
|
||||
.catch(function (err) {
|
||||
sub.unsubscribe();
|
||||
promiseResolved = true;
|
||||
utils._fireError({message: receiptError, data: err}, defer.eventEmitter, defer.reject);
|
||||
utils._fireError({message: 'Failed to check for transaction receipt:', data: err}, defer.eventEmitter, defer.reject);
|
||||
})
|
||||
// if CONFIRMATION listener exists check for confirmations, by setting canUnsubscribe = false
|
||||
.then(function(receipt) {
|
||||
@ -294,7 +293,7 @@ Method.prototype._confirmTransaction = function (defer, result, payload, extraFo
|
||||
} else {
|
||||
sub.unsubscribe();
|
||||
promiseResolved = true;
|
||||
utils._fireError({message: receiptError, data: err}, defer.eventEmitter, defer.reject);
|
||||
utils._fireError({message: 'Failed to subscribe to new newBlockHeaders to confirm the transactions receipt. Are you using HttpProvider? Please switch to Websockets.', data: err}, defer.eventEmitter, defer.reject);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -128,7 +128,7 @@ RequestManager.prototype.addSubscription = function (id, name, type, callback) {
|
||||
};
|
||||
|
||||
} else {
|
||||
throw new Error('This provider doesn\'t support subscriptions', this.provider);
|
||||
throw new Error('The provider doesn\'t support subscriptions: '+ this.provider.constructor.name);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -28,7 +28,7 @@ var XHR2 = require('xhr2'); // jshint ignore: line
|
||||
/**
|
||||
* HttpProvider should be used to send rpc calls over http
|
||||
*/
|
||||
var HttpProvider = function (host, timeout) {
|
||||
var HttpProvider = function HttpProvider(host, timeout) {
|
||||
this.host = host || 'http://localhost:8545';
|
||||
this.timeout = timeout || 0;
|
||||
this.connected = false;
|
||||
@ -38,7 +38,7 @@ var HttpProvider = function (host, timeout) {
|
||||
/**
|
||||
* Should be used to make async request
|
||||
*
|
||||
* @method sendAsync
|
||||
* @method send
|
||||
* @param {Object} payload
|
||||
* @param {Function} callback triggered on end with (err, result)
|
||||
*/
|
||||
|
@ -27,7 +27,7 @@ var errors = require('web3-core-helpers').errors;
|
||||
var oboe = require('oboe');
|
||||
|
||||
|
||||
var IpcProvider = function (path, net) {
|
||||
var IpcProvider = function IpcProvider(path, net) {
|
||||
var _this = this;
|
||||
this.responseCallbacks = {};
|
||||
this.notificationCallbacks = [];
|
||||
|
@ -29,7 +29,7 @@ if (typeof global !== 'undefined')
|
||||
// Default connection ws://localhost:8546
|
||||
|
||||
|
||||
var WebsocketProvider = function (path) {
|
||||
var WebsocketProvider = function WebsocketProvider(path) {
|
||||
var _this = this;
|
||||
this.responseCallbacks = {};
|
||||
this.notificationCallbacks = [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user