How to use the @liquality/errors.RpcError function in @liquality/errors

To help you get started, we’ve selected a few @liquality/errors 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 liquality / chainabstractionlayer / packages / jsonrpc-provider / lib / JsonRpcProvider.js View on Github external
_parseResponse ({ data, status, statusText, headers }) {
    if (headers['content-type'] !== 'application/json') {
      throw new RpcError(status, statusText, { data })
    }

    data = parse(data)
    debug('parsed jsonrpc response', data)
    if (data.error != null) {
      throw new RpcError(
        get(data, 'error.code', -32603),
        get(data, 'error.message', 'An error occurred while processing the RPC call')
      )
    }

    if (!has(data, 'result')) {
      throw new RpcError(-32700, 'Missing `result` on the RPC call result')
    }

    return data.result
  }
github liquality / chainabstractionlayer / packages / jsonrpc-provider / lib / JsonRpcProvider.js View on Github external
_parseResponse ({ data, status, statusText, headers }) {
    if (headers['content-type'] !== 'application/json') {
      throw new RpcError(status, statusText, { data })
    }

    data = parse(data)
    debug('parsed jsonrpc response', data)
    if (data.error != null) {
      throw new RpcError(
        get(data, 'error.code', -32603),
        get(data, 'error.message', 'An error occurred while processing the RPC call')
      )
    }

    if (!has(data, 'result')) {
      throw new RpcError(-32700, 'Missing `result` on the RPC call result')
    }

    return data.result
  }
github liquality / chainabstractionlayer / packages / jsonrpc-provider / lib / JsonRpcProvider.js View on Github external
_parseResponse ({ data, status, statusText, headers }) {
    if (headers['content-type'] !== 'application/json') {
      throw new RpcError(status, statusText, { data })
    }

    data = parse(data)
    debug('parsed jsonrpc response', data)
    if (data.error != null) {
      throw new RpcError(
        get(data, 'error.code', -32603),
        get(data, 'error.message', 'An error occurred while processing the RPC call')
      )
    }

    if (!has(data, 'result')) {
      throw new RpcError(-32700, 'Missing `result` on the RPC call result')
    }

    return data.result

@liquality/errors

[![Build Status](https://travis-ci.com/liquality/chainabstractionlayer.svg?branch=master)](https://travis-ci.com/liquality/chainabstractionlayer) [![Coverage Status](https://coveralls.io/repos/github/liquality/chainabstractionlayer/badge.svg?branch=master

MIT
Latest version published 2 years ago

Package Health Score

52 / 100
Full package analysis

Similar packages