Socket
Socket
Sign inDemoInstall

@nftx/errors

Package Overview
Dependencies
0
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @nftx/errors

This package contains error classes for common usecases.


Version published
Weekly downloads
22
decreased by-65.08%
Maintainers
2
Created
Weekly downloads
 

Changelog

Source

2.0.0 (2024-03-20)

Code Refactoring

  • combine cross-chain types for the 721 and 1155 subgraphs (1bfad43)
  • remove goerli (72c021d)

Features

BREAKING CHANGES

  • all references to goerli have been removed
  • any imports of the 721 or 1155 subgraph schemas will need to be updated

Readme

Source

@nftx/errors

This package contains error classes for common usecases.

Under the hood, the NFTX API will throw serialised versions of these errors, and nftx.js will automatically parse them back into errors.

Each error class includes a unique code, a human-readable message, and a toHttpResponse method that serialises the error.

The package also includes a hydrate function that parses a json object and returns an error, and hydrateResponse that will hydrate a toHttpResponse object.

Usage

import { BadRequestError } from '@nftx/errors';

const e = new BadRequestError('This is bad');

console.log(e.code, e.message);

throw e;
const e = new UnknownError('An unknown error happened');

const { status, body } = e.toHttpResponse();

const e2 = hydrateResponse({ status, body });

FAQs

Last updated on 20 Mar 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc