@ahmadnassri/error

2.0.4 • Public • Published

Extendable Error

Extendable Error Class for use with Node.js

license release semantic

Install

npm install @ahmadnassri/error

Usage

const ExtendableError = require('@ahmadnassri/error')

class MyError extends ExtendableError {
  // constructor is optionaly useful for adding custom arguments, or methods:
  constructor (code, message, extra) {
    super(message)

    this.code = code
    this.extra = extra
  }

  getCode () {
    return this.code
  }
}

Author: Ahmad Nassri • Twitter: @AhmadNassri

Readme

Keywords

Package Sidebar

Install

npm i @ahmadnassri/error

Weekly Downloads

22

Version

2.0.4

License

MIT

Unpacked Size

3.77 kB

Total Files

4

Last publish

Collaborators

  • ahmadnassri