Open bhuvaneshdesai opened 3 years ago
window.addEventListener('offline', disconnect);
async function disconnect() { try { if (jitsiAPI.room) { Object.entries(connectionListners).forEach(([event, fn]) => { jitsiAPI.room.off(JitsiMeetJS.events.conference[event], fn); }); Object.keys(jitsiAPI.room.participants).forEach((id) => { jitsiAPI.room.kickParticipant(id); }); await jitsiAPI.room.leave(); jitsiAPI.disconnect(); } } catch (error) { jitsiAPI.disconnect(); console.log('error leaving room', error); } }
_note in above snippet `connectionListners` is just object having event name as key and function which should be trigged when that event occurred_
other errors i was not able to find any particular reason yet.
Also to catch errors from global handler i used same snippet from jitsi-meet
that is
```javascript
function _setErrorHandlers() {
// attaches global error handler, if there is already one, respect it
if (JitsiMeetJS.getGlobalOnErrorHandler) {
const oldOnErrorHandler = window.onerror;
// eslint-disable-next-line max-params
window.onerror = (message, source, lineno, colno, error) => {
JitsiMeetJS.getGlobalOnErrorHandler(
message, source, lineno, colno, error);
if (oldOnErrorHandler) {
oldOnErrorHandler(message, source, lineno, colno, error);
}
};
const oldOnUnhandledRejection = window.onunhandledrejection;
window.onunhandledrejection = function(event) {
JitsiMeetJS.getGlobalOnErrorHandler(
null, null, null, null, event.reason);
if (oldOnUnhandledRejection) {
oldOnUnhandledRejection(event);
}
};
}
}
I was able to catch the error. but its still got logged in console which the sentry reported
Is there no answer to this?
I have setup video calling for most part it works fine but every once in a while following errors are thrown i tried all sort of event handlers to catch these errors but didn't help.
(i would try to avoid the
JitsiMeetJS.getGlobalOnErrorHandler()
).Best Would be if anyone explain why those errors caused and what's ideal way to handle them or even better prevent them in first place.
Focus error, retry after x
Strophe: request id x error y happened
Jingle error
Received P2P "session-initiate" when should not be in P2P mode
I get following errors too but above ones are important