custom-error-class

WebJar for custom-error-class

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

custom-error-class
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

custom-error-class
WebJar for custom-error-class
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/mafintosh/custom-error-class

Download custom-error-class

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/custom-error-class/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>custom-error-class</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/custom-error-class/
implementation 'org.webjars.npm:custom-error-class:1.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/custom-error-class/
implementation ("org.webjars.npm:custom-error-class:1.0.0")
'org.webjars.npm:custom-error-class:jar:1.0.0'
<dependency org="org.webjars.npm" name="custom-error-class" rev="1.0.0">
  <artifact name="custom-error-class" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='custom-error-class', version='1.0.0')
)
libraryDependencies += "org.webjars.npm" % "custom-error-class" % "1.0.0"
[org.webjars.npm/custom-error-class "1.0.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

custom-error-class

Straightforward ES6 class you can extend to make custom errors that are all instanceof Error with proper stacks.

npm install custom-error-class

Usage

const CustomError = require('custom-error-class')

class MyError extends CustomError {
  constructor () {
    super('an error happened')
    this.code = 'SOME_CODE'
  }
}

// Use this error as you normally would.
throw new MyError()

Credits to @pfrazee who wrote most of it.

License

MIT

Versions

Version
1.0.0