Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nftx/errors

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nftx/errors

This package contains error classes for common usecases.

  • 1.6.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-60%
Maintainers
2
Weekly downloads
 
Created
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

Package last updated on 05 Dec 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc