Improve debug output in WebSocket error guard

This commit is contained in:
Tony Garnock-Jones 2019-05-30 22:53:04 +01:00
parent 844bc3457d
commit 9d12ef311c
1 changed files with 2 additions and 2 deletions

View File

@ -209,17 +209,17 @@ function _server(host, port, httpsOptions) {
react { react {
const facet = currentFacet(); const facet = currentFacet();
const id = genUuid('_wsRequest');
const guard = (f) => { const guard = (f) => {
try { try {
f() f()
} catch (e) { } catch (e) {
// Swallow e, which will be some kind of websocket-related exception. // Swallow e, which will be some kind of websocket-related exception.
console.debug('WebSocket exception in actor '+facet.actor.toString(), e); console.debug('WebSocket '+id+' exception in actor '+facet.actor.toString(), e);
facet.stop(); facet.stop();
} }
}; };
let id = genUuid('_wsRequest');
assert WebSocket(id, server, pieces, url.query); assert WebSocket(id, server, pieces, url.query);
on stop guard(() => ws.close()); on stop guard(() => ws.close());