@crypto-connect/errors

v0.0.2-alpha.55
CryptoConnect custom errors

CryptoConnect Errors

import {
  UndocumentedResultError,
  CryptoConnectError,
  NoCredentialsError,
  NotAuthorizedError,
  ServerError,
} from "@crypto-connect/errors";

try {
  // Do something with Crypto Connect
  // ...
} catch (err) {
  if (err instanceof CryptoConnectError) {
    // All custom errors
  }

  if (err instanceof UndocumentedResultError) {
    // API response doesn't match CryptoConnect's expectations
  }

  if (err instanceof NoCredentialsError) {
    // Methods that requires authorization has been called before
    // credentials have been provided
  }

  if (err instanceof NotAuthorizedError) {
    // Credentials have been supplied but are not sufficient to authorize
    // the request
  }

  if (err instanceof ServerError) {
    // Server responded with a non-200 status
  }
}
npm i @crypto-connect/errors

Metadata

  • ISC
  • Whatever
  • chrisdrifte
  • released 9/4/2021

Downloads

Maintainers