Fixed error handling in createDirecctory (#311)
The error handling in `createDirecctory` had three major issues: * Racy check for existence of a directory - the directory could've been created or deleted in the meantime. * Attempt to handle race outside the reduce function wouldn't let it continue creating the remaining directories. * All errors that were **not** `EEXISTS` or `ENOENT` were silently ignored, leading to lot of frustration and hair pulling, because the code continued executing and then failed at attempt to open a file. These problems were fixed by moving `try` into the reduce closure, ignoring `EEXISTS` only and rethrowing all other errors. The logic modifying the error message for `ENOENT` was kept.pull/351/head
parent
a980d9c3fa
commit
99b3dbb798
Loading…
Reference in New Issue