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

Remove `domainEmitter` from output #25

Closed fasttime closed 1 year ago

fasttime commented 1 year ago

Before you open this issue, please complete the following tasks:

What were you expecting to happen?

Reporting this as a bug because it seems that the be behavior was not intended, but it could be also a feature.

The idea is that the output of a plugin-error should not include irrelevant information like the domainEmitter.

Related: https://github.com/gulpjs/gulp/issues/1329

What actually happened?

Currently the output includes a domainEmitter property with no helpful information when the error is emitted by a stream.

Please give us a sample of your gulpfile

My actual use case involves a self-written gulp plugin that uses plugin-error behind the scenes.

The following is a minimal example that shows the problem:

// gulptask.js
const gulp = require('gulp');
const PluginError = require('plugin-error');
const { PassThrough } = require('stream');

gulp.task('fail', function () {
    return new PassThrough({
        final: cb => cb(new PluginError('my-plugin', 'My message')),
        objectMode: true
    }).end();
});

Terminal output / screenshots

$ gulp fail

This will print:

Message:
    My message
Details:
    domainEmitter: [object Object]

It would be great if the output could be just

Message:
    My message

Please provide the following information:

Additional information

The simplest solution would be to domainEmitter to the set of ignored properties: https://github.com/gulpjs/plugin-error/blob/v2.0.0/index.js#L5-L15

I would gladly create a PR if the team agrees on this issue.

phated commented 1 year ago

Duplicate of #14

fasttime commented 1 year ago

Ah sorry, I saw the other issue but I thought it was related to console.log. I guess this can be closed then.