How to use the web3-core-helpers.errors.InvalidResponse function in web3-core-helpers

To help you get started, we’ve selected a few web3-core-helpers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MCROEngineering / zoom / test / web3 / HttpProviderCache.js View on Github external
request.onreadystatechange = function () {
            if (request.readyState === 4 && request.timeout !== 1) {
                var result = request.responseText;
                var error = null;
                try {
                    result = JSON.parse(result);
                }
                catch (e) {
                    error = errors.InvalidResponse(request.responseText);
                }
                if (_this.usecache === true || _this.savetocache === true) {
                    _this.toCache(payload, result);
                }
                othis.connected = true;
                callback(error, result);
            }
        };
        request.ontimeout = function () {
github MyEtherWallet / MyEtherWallet / src / wallets / web3-provider / providers / ws-web3-provider.js View on Github external
_this.lastChunkTimeout = setTimeout(function() {
        _this._timeout();
        throw errors.InvalidResponse(data);
      }, 1000 * 15);
github MCROEngineering / zoom / dist / lib / utils / WsProvider.js View on Github external
othis.lastChunkTimeout = setTimeout(function () {
                    othis.doTimeout();
                    throw errors.InvalidResponse(idata);
                }, 1000 * 15);
                return;
github ninabreznik / voting-ethereum-contract / node_modules / web3-core-requestmanager / src / index.js View on Github external
this.provider[this.provider.sendAsync ? 'sendAsync' : 'send'](payload, function (err, result) {
        if(result && result.id && payload.id !== result.id) return callback(new Error('Wrong response id "'+ result.id +'" (expected: "'+ payload.id +'") in '+ JSON.stringify(payload)));

        if (err) {
            return callback(err);
        }

        if (result && result.error) {
            return callback(errors.ErrorResponse(result));
        }

        if (!Jsonrpc.isValidResponse(result)) {
            return callback(errors.InvalidResponse(result));
        }

        callback(null, result.result);
    });
};
github ethereum / web3.js / packages / web3-providers-ws / src / index.js View on Github external
_this.lastChunkTimeout = setTimeout(function(){
                _this._timeout();
                throw errors.InvalidResponse(data);
            }, 1000 * 15);
github MCROEngineering / zoom / dist / lib / utils / HttpProvider.js View on Github external
request.onreadystatechange = function () {
            if (request.readyState === 4 && request.timeout !== 1) {
                var result = request.responseText;
                var error = null;
                try {
                    result = JSON.parse(result);
                }
                catch (e) {
                    error = errors.InvalidResponse(request.responseText);
                }
                if (_this.usecache === true) {
                    _this.toCache(payload, result);
                }
                othis.connected = true;
                callback(error, result);
            }
        };
        request.ontimeout = function () {
github ethereum / web3.js / packages / web3-providers-http / src / index.js View on Github external
request.onreadystatechange = function() {
        if (request.readyState === 4 && request.timeout !== 1) {
            var result = request.responseText;
            var error = null;

            try {
                result = JSON.parse(result);
            } catch(e) {
                error = errors.InvalidResponse(request.responseText);
            }

            _this.connected = true;
            callback(error, result);
        }
    };
github ninabreznik / voting-ethereum-contract / node_modules / web3-providers-ws / src / index.js View on Github external
_this.lastChunkTimeout = setTimeout(function(){
                _this._timeout();
                throw errors.InvalidResponse(data);
            }, 1000 * 15);
github ethereum / web3.js / packages / web3-providers-ipc / src / index.js View on Github external
_this.lastChunkTimeout = setTimeout(function(){
                _this._timeout();
                throw errors.InvalidResponse(data);
            }, 1000 * 15);
github ethereum / web3.js / packages / web3-core-requestmanager / src / index.js View on Github external
this.provider[this.provider.sendAsync ? 'sendAsync' : 'send'](payload, function (err, results) {
        if (err) {
            return callback(err);
        }

        if (!_.isArray(results)) {
            return callback(errors.InvalidResponse(results));
        }

        callback(null, results);
    });
};