arrows

arrows - error

@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

Returns

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.