.. | ||
index.js | ||
LICENSE | ||
package.json | ||
README.md |
plugin-error
Error handling for vinyl plugins. Just an abstraction of what's in gulp-util with minor changes.
Install with npm
$ npm i plugin-error --save
Usage
var PluginError = require('plugin-error');
new PluginError(pluginName, message[, options]);
Params
pluginName
should be the module name of your pluginmessage
{String|Object}: may be a string or an existing error objectoptions
{Object}
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.
Examples
All of the following are acceptable forms of instantiation:
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});
Related projects
- assemble: Static site generator for Grunt.js, Yeoman and Node.js. Used by Zurb Foundation, Zurb Ink, H5BP/Effeckt,… more
- gulp-util: Utility functions for gulp plugins
- gulp: The streaming build system
- generate: Project generator, for node.js.
- verb: Documentation generator for GitHub projects. Extremely powerful, easy to use, can generate anything from API… more
Running tests
Install dev dependencies:
$ npm i -d && npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Author
Jon Schlinkert
License
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on May 31, 2015.