From 8c614f6b25474a8e41c8334bdcd4c44d11371ab6 Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Fri, 30 Jan 2015 16:40:45 +0100 Subject: [PATCH] trap another error which was causing sporadic failures --- ChainPadSrv.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ChainPadSrv.js b/ChainPadSrv.js index f5ae8edf0..178f70d25 100644 --- a/ChainPadSrv.js +++ b/ChainPadSrv.js @@ -142,9 +142,14 @@ console.log("[" + userPass + "] registered"); var sendMsgs = function () { sendChannelMessage(ctx, chan, msg, function () { chan.push(client); - ctx.store.getMessages(chan.name, function (msg) { - sendMsg(msg, socket); - }); + try { + ctx.store.getMessages(chan.name, function (msg) { + sendMsg(msg, socket); + }); + } catch (e) { + console.log(e.stack); + try { socket.close(); } catch (e) { } + } }); }; if (newChan) {