Socket
Socket
Sign inDemoInstall

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


Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
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 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 09 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