copyDirRecursive callback doesn't always receive error as the first parameter #47

Closed
opened 2013-01-23 19:45:47 -08:00 by ViciousPotato · 1 comment
ViciousPotato commented 2013-01-23 19:45:47 -08:00 (Migrated from github.com)

Sometimes it receives nothing. It causes pain to use with other libraries that expect at least a null error.

Consider being used in async.waterfall, we have to

  async.waterfall([
    function(next) {
      wrench.copyDirRecursive(
        sourceDir, 
        destDir, 
        function(error) {
          // The problem with wrench is that when succeeds it will call callback
          // with nothing.
          if (error) return next(error);
          next(null);
        });
    },
    function(next) {
       ...
    }], callback);
};

instead of

  async.waterfall([
    function(next) {
      wrench.copyDirRecursive(
        sourceDir, 
        destDir, 
        next)
    },
    function(next) {
       ...
    }], callback);
};
Sometimes it receives nothing. It causes pain to use with other libraries that expect at least a `null` error. Consider being used in async.waterfall, we have to ``` javascript async.waterfall([ function(next) { wrench.copyDirRecursive( sourceDir, destDir, function(error) { // The problem with wrench is that when succeeds it will call callback // with nothing. if (error) return next(error); next(null); }); }, function(next) { ... }], callback); }; ``` instead of ``` javascript async.waterfall([ function(next) { wrench.copyDirRecursive( sourceDir, destDir, next) }, function(next) { ... }], callback); }; ```
ryanmcgrath commented 2013-05-03 13:19:12 -07:00 (Migrated from github.com)

Your pull request done fixed this here issue. Thanks!

Your pull request done fixed this here issue. Thanks!
This repository is archived. You cannot comment on issues.
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: code/wrench-js#47
No description provided.