Error helpers library
!npm (scoped)
!CircleCI
!David (path)
!Codecov
!npm bundle size (scoped)
!GitHub
1. Introduction
2. Installation
3. API reference
- createErrorClass
4. License
The library contains a set of helper functions for error handling.
The library has built-in type definitions, which provide an excellent IDE support.
Via NPM:
``sh`
npm i @arrows/error
Via Yarn:
`sh`
yarn add @arrows/error
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 messageserializeStacktrace
- 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:
`javascript`
const MyError = createErrorClass('MyError', 'some message')
Create a custom error class with serializable stacktrace:
`javascript``
const MyError = createErrorClass('MyError', 'some message', true)
Project is under open, non-restrictive ISC license.