Skip to content

Commit f534a26

Browse files
committed
Don't let errors in an application's message handling code get silently swallowed by any of the transports
1 parent cff4669 commit f534a26

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

lib/socket.io/transports/htmlfile.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ HTMLFile.prototype._onConnect = function(req, res){
3232
try {
3333
var msg = qs.parse(body);
3434
self._onMessage(msg.data);
35-
} catch(e){}
35+
} catch(e){
36+
listener.options.log('htmlfile message handler error - ' + e.stack);
37+
}
3638
res.writeHead(200, {'Content-Type': 'text/plain'});
3739
res.write('ok');
3840
res.end();

lib/socket.io/transports/xhr-multipart.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ Multipart.prototype._onConnect = function(req, res){
4646
try {
4747
var msg = qs.parse(body);
4848
self._onMessage(msg.data);
49-
} catch(e){}
49+
} catch(e){
50+
listener.options.log('xhr-multipart message handler error - ' + e.stack);
51+
}
5052
res.writeHead(200, headers);
5153
res.write('ok');
5254
res.end();

lib/socket.io/transports/xhr-polling.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ Polling.prototype._onConnect = function(req, res){
4848
// optimization: just strip first 5 characters here?
4949
var msg = qs.parse(body);
5050
self._onMessage(msg.data);
51-
} catch(e){}
51+
} catch(e){
52+
listener.options.log('xhr-polling message handler error - ' + e.stack);
53+
}
5254
res.writeHead(200, headers);
5355
res.write('ok');
5456
res.end();

0 commit comments

Comments
 (0)