@ahmadnassri/error

Extendable Error Class for use with Node >= 4.x

Usage no npm install needed!

<script type="module">
  import ahmadnassriError from 'https://cdn.skypack.dev/@ahmadnassri/error';
</script>

README

Extendable Error

license version super linter test release

Extendable Error Class for use with Node >= 4.x

Install

npm install --production --save @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
  }
}

License: ISC • Copyright: ahmadnassri.com • Github: @ahmadnassri • Twitter: @ahmadnassri