plugin-error
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

plugin-error

NPM version Downloads Build Status Coveralls Status

Error handling for Vinyl plugins.

Usage

var PluginError = require('plugin-error');

var err = new PluginError('test', {
  message: 'something broke',
});

var err = new PluginError({
  plugin: 'test',
  message: 'something broke',
});

var err = new PluginError('test', 'something broke');

var err = new PluginError('test', 'something broke', { showStack: true });

var existingError = new Error('OMG');
var err = new PluginError('test', existingError, { showStack: true });

API

new PluginError(pluginName, message[, options])

Error constructor that takes:

  • pluginName - a String that should be the module name of your plugin
  • message - a String message or an existing Error object
  • options - an Object of your options

Behavior:

  • By default the stack will not be shown. Set options.showStack to true if you think the stack is important for your error.
  • If you pass an error object as the message the stack will be pulled from that, otherwise one will be created.
  • If you pass in a custom stack string you need to include the message along with that.
  • Error properties will be included in err.toString(), but may be omitted by including { showProperties: false } in the options.

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.1
    101,851
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.0.1
    101,851
  • 2.0.0
    3,763
  • 1.0.1
    1,218,433
  • 1.0.0
    253
  • 0.1.2
    862,223
  • 0.1.1
    2
  • 0.1.0
    2

Package Sidebar

Install

npm i plugin-error

Weekly Downloads

2,186,527

Version

2.0.1

License

MIT

Unpacked Size

11.7 kB

Total Files

5

Last publish

Collaborators

  • yocontra
  • phated