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

btrz-errors

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

btrz-errors

Custom Errors for Betterez APIs

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

btrz-errors

A library to create a series of common or custom errors

It wraps the make-error-cause library and offers some conventions on top of it.

Usage

let BtrzErrors = require("btrz-errors").BtrzErrors;

let error = BtrzErrors.create("NEW_ERROR"); //Only a code, no message or causing error

let knownError = BtrzErrors.create(err);
// Giving just an error coming from another source will try to find a known error based on the
// message of the given error and return that error or null

let errorWithCause = BtrzErrors.create("WITH_CAUSE", err);
// Will return an error of type WithCause that holds the err in the .cause === err

let errorWithMessage = BtrzErrors.create("WITH_MESSAGE", "this is the message")
// will return an error of type WithMessage with the .message === "this is the message"

let complete = BtrzErrors.create("COMPLETE", err, "message");
// will return an error of type "Complete"
// .message === "message"
// .name == "Complete"
// .cause === err

Keywords

FAQs

Package last updated on 08 Mar 2016

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