You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-08-21 04:02:35 +03:00
Wrap /events response processing in a try/catch
This commit is contained in:
@@ -2058,6 +2058,7 @@ function _pollForEvents(client) {
|
|||||||
else {
|
else {
|
||||||
clearTimeout(timeoutObj);
|
clearTimeout(timeoutObj);
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
var events = [];
|
var events = [];
|
||||||
if (data) {
|
if (data) {
|
||||||
events = utils.map(data.chunk, _PojoToMatrixEventMapper(self));
|
events = utils.map(data.chunk, _PojoToMatrixEventMapper(self));
|
||||||
@@ -2138,6 +2139,11 @@ function _pollForEvents(client) {
|
|||||||
self.emit("event", e);
|
self.emit("event", e);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
console.error("Event stream error:");
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
_pollForEvents(self);
|
_pollForEvents(self);
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
console.error("/events error: %s", JSON.stringify(err));
|
console.error("/events error: %s", JSON.stringify(err));
|
||||||
|
Reference in New Issue
Block a user