Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grunt.util.error rendering #1223

Open
emilbayes opened this issue Sep 24, 2014 · 0 comments
Open

grunt.util.error rendering #1223

emilbayes opened this issue Sep 24, 2014 · 0 comments
Milestone

Comments

@emilbayes
Copy link

A colleague (@sp90) and I were adding error output from a terminal tool to a Grunt task, for Grunt to pass on to the user. The task is async and something along the lines of this:

grunt.registerMultiTask('terminal-task', 'Execute some terminal tool', function() {
   var done = this.async();

   this.files.forEachAsync(function(file, idx, next) {
      grunt.spawn({
         cmd: 'sometool',
         args: [file]
      }, function(err, res) {
         if(err !== null) return next(grunt.util.error(err));
         //Do something with res
         next();
      });
   }, done);

What we were surprised to see was that the error was not rendered by Grunt like grunt.log.error, which is what we expected, but rendered like grunt.log.warn. I tried to dig through the commit log, but didn't see anything about this being a conscious decision. The closest I found was #1163, but is in my opinion only tangentially related.

The relevant lines are lib/util/task.js#L220-L222 -> lib/grunt.js#L136-L138 -> lib/grunt/fail.js#L28-L40

What I want to know is:

  • is this intended behaviour or legacy?
  • Can/should we fix this?
  • Is grunt.util.error meant to be used like this?
@vladikoff vladikoff added this to the 0.4.6 milestone Oct 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants