Error handling - jitsi lib - Strophie error, Jingle error etc

have setup video calling in react app using lib-jitsi-meet 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.

  1. Strophe: request id x error y happened

    Error: Strophe: request id 114.1 error 0 happened
      at Object.r.Strophe.log(/js/lib-jitsi-meet.min.js:17:17881)
      at Object.error(/js/lib-jitsi-meet.min.js:1:23478)
      at P.Bosh._onRequestStateChange(/js/lib-jitsi-meet.min.js:1:54925)
      at XMLHttpRequest.r(../../src/helpers.ts:90:17)
    

i get above error when its connected to jitsi but i turn off my internet or sometimes randomly also i get this error thrown in console(mostly because of connectivity issues).

Question is what this error is about and how can i catch it and work from there.
i have already tried following

window.addEventListener('offline', disconnect);
function disconnect() {
       //remove room listners
        //leave room
        jitsiAPI.disconnect(); //disconnect
  }

Also i get following errors sometimes but was not able to find exact reason for them
2. Jingle error

Error: Jingle error: {"reason":"timeout","session":"JingleSessionPC[p2p=true,initiator=false,sid=c3598f3a49b2]"}
  at ? (/js/lib-jitsi-meet.min.js:1:220487)
  at I.TimedHandler.handler(/js/lib-jitsi-meet.min.js:1:31407)
  at I.TimedHandler.run(/js/lib-jitsi-meet.min.js:1:26948)
  at I.Connection._onIdle(/js/lib-jitsi-meet.min.js:1:42980)
  at ? (/js/lib-jitsi-meet.min.js:1:43150)
  at r(../../src/helpers.ts:90:17)
  1. Received P2P “session-initiate” when should not be in P2P mode

     Error: Received P2P "session-initiate" when should not be in P2P mode
       at ie._rejectIncomingCall(/js/lib-jitsi-meet.min.js:10:60084)
       at ie._onIncomingCallP2P(/js/lib-jitsi-meet.min.js:10:57951)
       at ie.onIncomingCall(/js/lib-jitsi-meet.min.js:10:58070)
       at a.emit(/js/lib-jitsi-meet.min.js:1:129707)
       at g.onJingle(/js/lib-jitsi-meet.min.js:10:200299)
       at I.Handler.run(/js/lib-jitsi-meet.min.js:1:26596)
       at ? (/js/lib-jitsi-meet.min.js:1:35034)
       at Object.forEachChild(/js/lib-jitsi-meet.min.js:1:18258)
       at I.Connection._dataRecv(/js/lib-jitsi-meet.min.js:1:34883)
       at P.Bosh._onRequestStateChange(/js/lib-jitsi-meet.min.js:1:54868)
       at XMLHttpRequest.r(../../src/helpers.ts:90:17)
    

I get following errors too but above ones are important

A

Error: Strophe: error: Cannot read property 'addListener' of null
  at Object.r.Strophe.log(/js/lib-jitsi-meet.min.js:17:17881)
  at Object.fatal(/js/lib-jitsi-meet.min.js:1:23529)
  at Object._handleError(/js/lib-jitsi-meet.min.js:1:23139)
  at I.Handler.run(/js/lib-jitsi-meet.min.js:1:26624)
  at ? (/js/lib-jitsi-meet.min.js:1:35034)
  at Object.forEachChild(/js/lib-jitsi-meet.min.js:1:18258)
  at I.Connection._dataRecv(/js/lib-jitsi-meet.min.js:1:34883)
  at P.Bosh._onRequestStateChange(/js/lib-jitsi-meet.min.js:1:54868)
  at XMLHttpRequest.r(../../src/helpers.ts:90:17)

B

Error: Strophe: TypeError: Cannot read property 'addListener' of null
    at s._onMediaSessionStarted (https://beta.pyjamahr.com/js/lib-jitsi-meet.min.js:17:128221)
    at a.<anonymous> (https://beta.pyjamahr.com/js/lib-jitsi-meet.min.js:17:128074)
    at a...
  at s._onMediaSessionStarted(/js/lib-jitsi-meet.min.js:17:128221)
  at a.<anonymous>(/js/lib-jitsi-meet.min.js:17:128074)
  at a.emit(/js/lib-jitsi-meet.min.js:1:129707)
  at ? (/js/lib-jitsi-meet.min.js:10:67184)
  at I.Handler.handler(/js/lib-jitsi-meet.min.js:1:31189)
  at I.Handler.run(/js/lib-jitsi-meet.min.js:1:26596)
  at ? (/js/lib-jitsi-meet.min.js:1:35034)
  at Object.forEachChild(/js/lib-jitsi-meet.min.js:1:18258)
  at I.Connection._dataRecv(/js/lib-jitsi-meet.min.js:1:34883)
  at P.Bosh._onRequestStateChange(/js/lib-jitsi-meet.min.js:1:54868)
  at XMLHttpRequest.r(../../src/helpers.ts:90:17)
  at Object.r.Strophe.log(/js/lib-jitsi-meet.min.js:17:17881)
  at Object.fatal(/js/lib-jitsi-meet.min.js:1:23529)
  at Object._handleError(/js/lib-jitsi-meet.min.js:1:22920)
  at I.Handler.run(/js/lib-jitsi-meet.min.js:1:26624)
  at ? (/js/lib-jitsi-meet.min.js:1:35034)
  at Object.forEachChild(/js/lib-jitsi-meet.min.js:1:18258)
  at I.Connection._dataRecv(/js/lib-jitsi-meet.min.js:1:34883)
  at P.Bosh._onRequestStateChange(/js/lib-jitsi-meet.min.js:1:54868)
  at XMLHttpRequest.r(../../src/helpers.ts:90:17)

Also to catch errors from global handler i used same snippet from jitsi-meet
that is

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