From 5fe3ffabd1e4d5acdeee9a6e0fb2b77bc3204c56 Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Tue, 13 Sep 2016 17:10:50 +0200 Subject: [PATCH] stop using waitFor.abort() which is apparently not implemented --- storage/file.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/storage/file.js b/storage/file.js index df391db7b..8de76447d 100644 --- a/storage/file.js +++ b/storage/file.js @@ -77,26 +77,29 @@ var getChannel = function (env, id, callback) { } var path = mkPath(env, id); var fileExists; + var errorState; nThen(function (waitFor) { checkPath(path, waitFor(function (err, exists) { if (err) { - waitFor.abort(); + errorState = true; complete(err); return; } fileExists = exists; })); }).nThen(function (waitFor) { + if (errorState) { return; } if (!fileExists) { return; } readMessages(path, function (msg) { channel.messages.push(msg); }, waitFor(function (err) { if (err) { - waitFor.abort(); + errorState = true; complete(err); } })); }).nThen(function (waitFor) { + if (errorState) { return; } var stream = channel.writeStream = Fs.createWriteStream(path, { flags: 'a' }); stream.on('open', waitFor()); stream.on('error', function (err) { @@ -110,6 +113,7 @@ var getChannel = function (env, id, callback) { } }); }).nThen(function (waitFor) { + if (errorState) { return; } complete(); }); };