From 4b52453e47fc02d983cbbf8d7bb3c58851e2570b Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Mon, 25 Jul 2016 16:13:23 +0300 Subject: [PATCH] Pass catched exceptions, fix error in addMessage --- operetta.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/operetta.js b/operetta.js index 37605f5..dd89d0c 100644 --- a/operetta.js +++ b/operetta.js @@ -148,7 +148,7 @@ Syncer.runFetch = function*(what, params, boxId, processor) var cb, wait; f.on('message', function(msg, seqnum) { - gen.run(self.onMessage(msg, seqnum, boxId, processor), checkFinish, checkFinish); + gen.run(self.onMessage(msg, seqnum, boxId, processor), checkFinish, function(e) { checkFinish(); throw e; }); }); cb = gen.cb(); @@ -158,7 +158,7 @@ Syncer.runFetch = function*(what, params, boxId, processor) if (self.parsed <= 0) cb(); else if (self.pending.length > 0) - gen.run(self[processor](self.pending, boxId), saveLast, saveLast); + gen.run(self[processor](self.pending, boxId), saveLast, function(e) { saveLast(); throw e; }); }); function saveLast() @@ -280,6 +280,7 @@ Syncer.saveMessages = function*(messages, boxId) Syncer.addMessage = function*(msgrow, attrs) { + var self = this; var pgtx, end_transaction; try {