Skip to content

PluginError toString output #14

Open

Description

@demurgos

Imported from gulpjs/gulp-util#74.

Currently console.log'ing the error outputs way too much:

{ [Error: error main.scss (Line 7: Invalid CSS after "@import ": expected file to import (string or url()), was "blah;")]
  message: 'error main.scss (Line 7: Invalid CSS after "@import ": expected file to import (string or url()), was "blah;")',
  showStack: false,
  showProperties: true,
  plugin: 'gulp-ruby-sass',
  __safety: { toString: [Function] } }

It should only output:

[Error: error main.scss (Line 7: Invalid CSS after "@import ": expected file to import (string or url()), was "blah;")]

Or even better:

[gulp-ruby-sass error: error main.scss (Line 7: Invalid CSS after "@import ": expected file to import (string or url()), was "blah;")]

Just define a .toString method for it outputting what we want.

re yeoman/generator-webapp#242 (comment)

/cc @sindresorhus @contra

Activity

  1. fasttime commented on Dec 5, 2022

    @fasttime
    Contributor

    Just noting that console.log does not use toString to format its output, e.g.

    console.log({ foo: 'bar', toString: () => 'nice text' });

    outputs

    { foo: 'bar', toString: () => 'nice text' }
    

    If the goal is to change the output of console.log, as the ticket description implies, one has to use util.inspect.custom:

    const util = require('util');
    
    console.log({ foo: 'bar', [util.inspect.custom]: () => 'nice text' });

    outputs:

    nice text
    

    Regardless, it would be nice to remove some unnecessary information from the output of toString, like domainEmitter [object Object].

  2. phated commented on Dec 5, 2022

    @phated
    Member

    @fasttime We already made attempts to improve this in 932946a - if we missed a property, I'm happy to add it to the list of exclusions and release as a bug fix. Want to PR?

  3. fasttime commented on Dec 6, 2022

    @fasttime
    Contributor

    @phated Okay, I made a PR: #26.

  4. added this to v6 and removed this from post-v5on Sep 27, 2026
  5. moved this from Todo to No status in v6on Sep 27, 2026
  6. moved this to Backlog in v6on Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions