JSPM

@metaplex-foundation/cusper

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 84961
  • Score
    100M100P100Q184895F
  • License Apache-2.0

Resolves Custom Program Errors from Solana program logs or error codes.

Package Exports

  • @metaplex-foundation/cusper
  • @metaplex-foundation/cusper/dist/src/cusper.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@metaplex-foundation/cusper) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Cusper Build Lint and Test Cusper

Resolves Custom Program Errors from Solana program logs or error codes.

Example

import { initCusper } from '@metaplex-foundation/cusper'

const cusper = initCusper(/* optionally provide custom error resolver here */)

const logs = [
  'Program CwrqeMj2U8tFr1Rhkgwc84tpAsqbt9pTt2a4taoTADPr invoke [1]',
  'Program log: Custom program error: 0x07D0',
]
function showError() {
  try {
    const error = { ...new Error('Test error'), logs }
    cusper.throwError(error)
  } catch (err) {
    console.error(err)
  }
}

showError()
AnchorError#ConstraintMut: A mut constraint was violated
    at showError (/cusper/test/test/ex.ts:13:12)
    [ .. ]

API

Please find the API docs here

LICENSE

Apache-2.0