包详细信息

plugin-error

gulpjs9.8mMIT2.0.1

Error handling for Vinyl plugins.

error, plugin, gulp-util

自述文件

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

更新日志

Changelog

2.0.1 (2022-12-06)

Bug Fixes

  • Exclude domainEmitter from output (#26) (2a89513)

2.0.0 (2022-07-01)

⚠ BREAKING CHANGES

  • Don't include domain information in output (#19)
  • Avoid modifying arguments (#21)
  • Allow to be constructed without new
  • Normalize repository, dropping node <10.13 support (#22)

Bug Fixes

  • Allow to be constructed without new (8fe9c64)
  • Avoid modifying arguments (#21) (6c05aba)
  • Don't include domain information in output (#19) (932946a)
  • Remove defaulting name since it is always set (8fe9c64)

Miscellaneous Chores

  • Normalize repository, dropping node <10.13 support (#22) (8fe9c64)