How to use the @liquality/errors.NoProviderError 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 / client / lib / Client.js View on Github external
getProviderForMethod (method, requestor = false) {
    if (this._providers.length === 0) {
      throw new NoProviderError('No provider provided. Add a provider to the client')
    }

    let indexOfRequestor = requestor
      ? findLastIndex(
        this._providers,
        provider => requestor.constructor === provider.constructor
      ) : this._providers.length

    if (indexOfRequestor === -1) indexOfRequestor = 0

    const provider = findLast(
      this._providers,
      provider => isFunction(provider[method]), indexOfRequestor - 1
    )

    if (provider == null) {

@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