Added some additional error handlers to get a better grip on connection issues
Summary: I think it is good to have error handlers where-ever possible, so that there is historical data in our monitoring when we need it, and can track from which point of the code it originates :) Reviewed By: jknoxville Differential Revision: D21040059 fbshipit-source-id: 1c07fbfa65379739554bc98f83761ae97870ba82
This commit is contained in:
committed by
Facebook GitHub Bot
parent
2d68006e3f
commit
a5e5ed5b7b
@@ -174,6 +174,9 @@ export default class Client extends EventEmitter {
|
|||||||
onSubscribe(subscription) {
|
onSubscribe(subscription) {
|
||||||
subscription.request(Number.MAX_SAFE_INTEGER);
|
subscription.request(Number.MAX_SAFE_INTEGER);
|
||||||
},
|
},
|
||||||
|
onError(payload) {
|
||||||
|
console.error('[client] connection status error ', payload);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -230,7 +230,8 @@ class Server extends EventEmitter {
|
|||||||
cleanup();
|
cleanup();
|
||||||
});
|
});
|
||||||
|
|
||||||
ws.on('error', () => {
|
ws.on('error', (error) => {
|
||||||
|
console.error('[server] ws connection error ', error);
|
||||||
cleanup();
|
cleanup();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -265,7 +266,7 @@ class Server extends EventEmitter {
|
|||||||
onNext(payload) {
|
onNext(payload) {
|
||||||
if (payload.kind == 'ERROR' || payload.kind == 'CLOSED') {
|
if (payload.kind == 'ERROR' || payload.kind == 'CLOSED') {
|
||||||
client.then((client) => {
|
client.then((client) => {
|
||||||
console.debug(`Device disconnected ${client.id}`, 'server');
|
console.log(`Device disconnected ${client.id}`, 'server', payload);
|
||||||
server.removeConnection(client.id);
|
server.removeConnection(client.id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -273,6 +274,9 @@ class Server extends EventEmitter {
|
|||||||
onSubscribe(subscription) {
|
onSubscribe(subscription) {
|
||||||
subscription.request(Number.MAX_SAFE_INTEGER);
|
subscription.request(Number.MAX_SAFE_INTEGER);
|
||||||
},
|
},
|
||||||
|
onError(error) {
|
||||||
|
console.error('[server] connection status error ', error);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user