tree: 9c3551d2d496180b5ba04f8b38ffed374ed150d5 [path history] [tgz]
  1. index.d.ts
  2. index.js
  3. LICENSE
  4. package.json
  5. README.md
third_party/devtools/node_modules/plugin-error/README.md

plugin-error

NPM version Downloads Build Status AppVeyor Build Status Coveralls Status Gitter chat

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