ryanmcgrath / wrench-js

Recursive file operations in Node.js
MIT License
435 stars 71 forks source link

copyDirSyncRecursive uses multiple ways to communicate errors #103

Open oliversalzburg opened 9 years ago

oliversalzburg commented 9 years ago

copyDirSyncRecursive both returns and throws errors, depending on where the error happens.

So you'd have to

try {
  var e = wrench.copyDirSyncRecursive();
  if( e ) {
    throw e;
  }
} catch( e ) {
  // Handle error
}

I don't see why this is necessary. throw should be the way to go here.

daniel-white commented 9 years ago

:+1: this bit me please be consistent.