Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 2, 2024 via pnpm
Package summary
Share
0
issues
1
license
1
ISC
Package created
8 Oct 2014
Version published
19 Feb 2020
Maintainers
3
Total deps
1
Direct deps
0
License
ISC

Issues

0
This package has no issues

Licenses

ISC License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
make-error@1.3.6
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of make-error 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does make-error do?

The "make-error" npm package is a handy tool designed to assist developers in creating their own unique error types to use in their JavaScript code. It provides essential features, including compatibility with Node.js and browsers, instanceof support, error.name and error.stack support, and complies with the Content Security Policy (CSP), ensuring it avoids utilizing eval(). This package is a highly beneficial addition to any codebase requiring a higher level of error customization and targeted error debugging.

How do you use make-error?

"Make-error" is a user-friendly package and can be used effortlessly. Start by installing the npm package using the command npm install --save make-error. Then require the package in your JavaScript file using var makeError = require("make-error").

You can create your basic named error with the following code:

var CustomError = makeError("CustomError");
throw new CustomError("a message");

For a more advanced error class, you can follow this pattern:

function CustomError(customValue) {
  CustomError.super.call(this, "custom error message");
  this.customValue = customValue;
}
makeError(CustomError);
// You can extend the prototype
CustomError.prototype.myMethod = function CustomError$myMethod() {
  console.log("CustomError.myMethod (%s, %s)", this.code, this.message);
};
// Throwing your Custom error
try {
  throw new CustomError(42);
} catch (error) {
  error.myMethod();
}

For specialized errors use:

var SpecializedError = makeError("SpecializedError", CustomError);
throw new SpecializedError(42);

To utilize inheritance with ES2015+:

import { BaseError } from "make-error";
class CustomError extends BaseError {
  constructor() {
    super("custom error message");
  }
}

Where are the make-error docs?

The entire documentation for the "make-error" npm package can be found within the README file on the official GitHub repository, which is git://github.com/JsCommunity/make-error.git. Here, you can find comprehensive details regarding the various features, installation instructions, usage examples, and more. It's your one-stop spot for everything you need to know about the "make-error" package.