Turn down the volume on websocket send error debug messages

This commit is contained in:
Tony Garnock-Jones 2019-06-20 12:46:59 +01:00
parent 413f28bf20
commit 553490e77e
1 changed files with 6 additions and 4 deletions

View File

@ -210,19 +210,21 @@ function _server(host, port, httpsOptions) {
react {
const facet = currentFacet();
const id = genUuid('_wsRequest');
const guard = (f) => {
const guard = (context, f) => {
try {
f()
} catch (e) {
// Swallow e, which will be some kind of websocket-related exception.
console.debug('WebSocket '+id+' exception in actor '+facet.actor.toString(), e);
console.debug(
'WebSocket '+id+' exception in actor '+facet.actor.toString()+' during '+context+':',
e.message);
facet.stop();
}
};
assert WebSocket(id, server, pieces, url.query);
on stop guard(() => ws.close());
on stop guard('close', () => ws.close());
ws.on('close', Dataspace.wrapExternal(() => {
facet.stop();
@ -235,7 +237,7 @@ function _server(host, port, httpsOptions) {
}
on message DataOut(id, $message) {
guard(() => ws.send(Bytes.toIO(message)));
guard('send', () => ws.send(Bytes.toIO(message)));
}
stop on retracted Observe(WebSocket(_, server, pathPattern, _));