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

plugin-error

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

plugin-error

Error handling for Vinyl plugins.

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created

What is plugin-error?

The plugin-error npm package is designed to simplify error handling in plugin development, particularly for Gulp plugins. It provides a consistent way to create and manage errors, making it easier to debug and handle errors in a standardized manner.

What are plugin-error's main functionalities?

Creating a PluginError

This feature allows you to create a new PluginError instance. The first argument is the plugin name, and the second argument is the error message. This helps in identifying which plugin caused the error.

const PluginError = require('plugin-error');
const err = new PluginError('MyPlugin', 'Something went wrong!');
console.error(err.toString());

Handling Error Options

This feature allows you to pass an options object to the PluginError constructor. The options can include properties like 'message' and 'showStack' to customize the error output.

const PluginError = require('plugin-error');
const err = new PluginError('MyPlugin', {
  message: 'Something went wrong!',
  showStack: true
});
console.error(err.toString());

Using Error Codes

This feature allows you to specify an error code, which can be useful for programmatically identifying different types of errors.

const PluginError = require('plugin-error');
const err = new PluginError('MyPlugin', {
  message: 'Something went wrong!',
  code: 'EPLUGIN'
});
console.error(err.toString());

Other packages similar to plugin-error

Keywords

FAQs

Package last updated on 06 Dec 2022

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