diff --git a/lib/storage.js b/lib/storage.js index 28b8416..128f9cc 100755 --- a/lib/storage.js +++ b/lib/storage.js @@ -59,13 +59,14 @@ storage.flushToStorage = function (options, callback) { if (err) { return callback(err); } fs.fsync(fd, function (errFS) { fs.close(fd, function (errC) { - var e = null; if (errFS || errC) { - e = new Error('Failed to flush to storage'); + var e = new Error('Failed to flush to storage'); e.errorOnFsync = errFS; e.errorOnClose = errC; + return callback(e); + } else { + return callback(null); } - return callback(e); }); }); });