From e16c3f3f80f08e10ff94e853089375e0a256bada Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Wed, 15 Jan 2014 13:23:53 -0500 Subject: [PATCH] added try catch to socket calls --- src/socket.io/index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/socket.io/index.js b/src/socket.io/index.js index c4e8085232..664f11dd5b 100644 --- a/src/socket.io/index.js +++ b/src/socket.io/index.js @@ -162,10 +162,18 @@ Sockets.init = function() { // Call the requested method if (Namespaces[namespace].before) { Namespaces[namespace].before(sessionData, function() { - methodToCall.apply(Namespaces, socketArgs); + try { + methodToCall.apply(Namespaces, socketArgs); + } catch (e) { + winston.error(e.message); + } }); } else { - methodToCall.apply(Namespaces, socketArgs); + try { + methodToCall.apply(Namespaces, socketArgs); + } catch (e) { + winston.error(e.message); + } } // winston.info('[socket.io] Executing: ' + payload.name); } else {