davglass / cpr

Nodejs cp -R
Other
79 stars 80 forks source link

Standardise errors to be more node-like, fixes #5. #6

Closed satazor closed 10 years ago

satazor commented 10 years ago

I ended up with the following callback logic for all the cases, which I think is more node-like and intuitive.

cpr('from', 'to', function (err, files) {
      // Standard node-like error instance
      if (err) {
         console.log(err.message);
         // err.list is the original errors that were caught when copying
         // Note that this is for advanced usage
         err.list && err.list.forEach(function (err) { console.log('>', err.message); });
     }
});

If you guys don't agree, I can always remake to do what I original said.

satazor commented 10 years ago

Bump.

davglass commented 10 years ago

Published as cpr@0.2.0

satazor commented 10 years ago

Thanks :)