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

@arrows/error

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arrows/error

Error helpers library

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@arrows/error

npm (scoped) CircleCI David (path) Codecov npm bundle size (scoped) GitHub

Table of contents

  1. Introduction
  2. Installation
  3. API reference
  4. License

Introduction

The library contains a set of helper functions for error handling.

The library has built-in type definitions, which provide an excellent IDE support.

Installation

Via NPM:

npm i @arrows/error

Via Yarn:

yarn add @arrows/error

API reference

createErrorClass

Creates custom error class that returns extended error object that can be serialized to JSON.

Parameters
  • name - The error name (should be the same as the name of the variable to which the class is assigned)
  • message - Error message
  • serializeStacktrace An optional boolean flag, to indicate weather a stacktrace should be serialized (default: false)
Returns
  • Returns custom error class that takes one optional argument - error details
Interface
(name , message, serializeStacktrace?) => custom_error_class
Examples

Create a custom error class:

const MyError = createErrorClass('MyError', 'some message')

Create a custom error class with serializable stacktrace:

const MyError = createErrorClass('MyError', 'some message', true)

License

Project is under open, non-restrictive ISC license.

Keywords

FAQs

Package last updated on 16 Oct 2019

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