Skip to content

Repository files navigation

plugin-error

NPM versionDownloadsBuild StatusCoveralls Status

Error handling for Vinyl plugins.

Usage

varPluginError=require('plugin-error');varerr=newPluginError('test',{message: 'something broke',});varerr=newPluginError({plugin: 'test',message: 'something broke',});varerr=newPluginError('test','something broke');varerr=newPluginError('test','something broke',{showStack: true});varexistingError=newError('OMG');varerr=newPluginError('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

About

Error handling for vinyl plugins. Just an abstraction of what's in gulp-util with minor reformatting.

Resources

Security policy

Stars

20 stars

Watchers

6 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages