gulpjs / plugin-error

Error handling for vinyl plugins. Just an abstraction of what's in gulp-util with minor reformatting.
MIT License
19 stars 13 forks source link

name always is `Error` #2

Closed tunnckoCore closed 6 years ago

tunnckoCore commented 9 years ago

Name of created error always is Error not PluginError by default. It never sets the name to PluginError here. So it is Error until we {name: 'MyError'}.

var PluginError = require('plugin-error')
var err = new PluginError('foo', 'bar baz')
console.log(String(err))

outputs

[charlike@archlinux ~/dev]$ node test.js 
Error in plugin "foo"
Message:
    bar baz
jonschlinkert commented 9 years ago

hmm, I might not have time to look at this for a few days or longer. if you feel like doing a pr that would be great, otherwise I'll try to take a look later this week or weekend

demurgos commented 6 years ago

I don't remember the exact details but it may be caused by the call to the native error constructor. I remember that it has some special behavior that may reset some properties.

phated commented 6 years ago

I checked this behavior in gulp-util and it's the same. I'm going to close this unless there's a compelling reason (and hopefully a PR)