make-error-cause

WebJar for make-error-cause

License

License

GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

make-error-cause
Last Version

Last Version

2.3.0
Release Date

Release Date

Type

Type

jar
Description

Description

make-error-cause
WebJar for make-error-cause
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/blakeembrey/make-error-cause

Download make-error-cause

How to add to project

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

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : make-error jar [1.3.5,2)

Project Modules

There are no modules declared in this project.

Make Error Cause

NPM version NPM downloads Build status Test coverage

Make your own nested errors.

Features

  • Compatible with node.js and browsers
  • Works with instanceof
  • Automatic full stack traces in node.js (supports inspect())
  • Output full stack trace with fullStack(err)
  • Extends make-error

Installation

npm install make-error-cause --save

Usage

import { BaseError, fullStack } from "make-error-cause";

class CustomError extends BaseError {
  constructor(message, cause) {
    super(message, cause);
  }
}

const error = new Error("Boom!");
const customError = new CustomError("Another boom!", error);

console.log(customError); // Automatically prints full stack trace using `fullStack(this)`.
console.log(customError.cause); // Check causes via the `.cause` property.

console.log(customError instanceof Error); //=> true

Attribution

Inspired by verror, and others, but created lighter and without core dependencies for browser usage.

Other references:

License

Apache 2.0

Versions

Version
2.3.0
1.2.2
1.2.1
1.1.0
1.0.1