Error handling for Vinyl plugins.
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});Error constructor that takes:
pluginName- aStringthat should be the module name of your pluginmessage- aStringmessage or an existingErrorobjectoptions- anObjectof your options
Behavior:
- By default the stack will not be shown. Set
options.showStackto 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.
MIT
