0.1.6 • Published 6 years ago

@mosteast/base-error v0.1.6

Weekly downloads
16
License
ISC
Repository
github
Last release
6 years ago

Better error

Project Information

  • Main problem this package solves: Make errors easier to extend, structure.
  • Main language: Typescript.

Getting started

class My_error extends E {
  message = 'Default message'
  eid = 'E123'

  constructor(...argS) {
    super()
    this.init(...argS)
  }
}

// Use default message
throw new My_error() // My_error: Default message

// Custom message
throw new My_error('Invalid configuration') // My_error: Invalid configuration

// Error message with solution
throw new My_error('Invalid configuration', 'Configure .env file first') // My_error: Invalid  configuration

// Error with more information
throw new My_error({
  message: 'Invalid configuration',
  solution: 'Configure .env file first',
  eid: 'E456',
  level: 'internal'
})
npm i # Install.
npm t # Run test first.
npm start # Start development.

{Can do this}

{Example}

{Can do that}

{Example}

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago