The following is a bug:
34: if (!error) done();
If an error is thrown, done() must still be called to tell Grunt that the asych task has completed, despite the fact that it threw an error.
Best is to pass the error to Grunt for logging (.message property), as follows:
done((error) ? error : '');
"If (error) has a value, as opposed to null, the ternary evaluates to true, the returns the error, and done(error) is called. If error is null, the ternary evaluates to false, returns an empty string, and simply call done()."
I also thought of the following possibilities, but didn't test them:
Is it possible that we could simply replace line 34 with #3, because the callback parameter "error" will be null in the absence of an error? I ran out of time, played it safe, and used the code above.
I checked on the #grunt IRC channel, and they recommend the #3 solution in the previous post:
As the convention is to send null with success.
Thanks! I just pushed 0.2.2