Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

make-error

Package Overview
Dependencies
Maintainers
3
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

make-error

Make your own error types!

  • 1.3.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
25M
decreased by-4.24%
Maintainers
3
Weekly downloads
 
Created

What is make-error?

The make-error package is a simple library for creating custom error types in JavaScript. It is useful for defining new error constructors that work similarly to native Error types, allowing for better error handling and debugging in applications.

What are make-error's main functionalities?

Creating custom error types

This feature allows developers to create their own error types that can be used throughout their codebase. The custom error types will inherit from the base Error class, making them compatible with standard error handling mechanisms.

const makeError = require('make-error');
const CustomError = makeError('CustomError');

throw new CustomError('This is a custom error message.');

Extending custom error types

Developers can also extend their custom error types to create a hierarchy of errors. This is useful for creating more specific error types that still share common behavior with their parent error types.

const makeError = require('make-error');
const BaseError = makeError('BaseError');
const SpecificError = makeError(BaseError);

throw new SpecificError('This is a more specific error message.');

Other packages similar to make-error

Keywords

FAQs

Package last updated on 19 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc