Socket
Socket
Sign inDemoInstall

plugin-error

Package Overview
Dependencies
Maintainers
1
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. Just an abstraction of what's in gulp-util with minor changes.


Version published
Weekly downloads
2.2M
decreased by-1.9%
Maintainers
1
Weekly downloads
 
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

FAQs

Package last updated on 01 May 2015

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