@@ -22,6 +22,7 @@ import FileSharing from './FileSharing';
2222import Lobby from './Lobby' ;
2323import Polls from './Polls' ;
2424import RoomMetadata from './RoomMetadata' ;
25+ import { handleStropheError } from './StropheErrorHandler' ;
2526import XmppConnection , { ErrorCallback } from './XmppConnection' ;
2627import XMPP , { FEATURE_TRANSCRIBER } from './xmpp' ;
2728
@@ -634,7 +635,11 @@ export default class ChatRoom extends Listenable {
634635 this . initialDiscoRoomInfoReceived = true ;
635636 this . eventEmitter . emit ( XMPPEvents . ROOM_DISCO_INFO_UPDATED ) ;
636637 } , error => {
637- logger . error ( 'Error getting room info: ' , error ) ;
638+ handleStropheError ( error , {
639+ operation : 'get room disco info' ,
640+ roomJid : this . roomjid ,
641+ userJid : this . connection . jid
642+ } ) ;
638643 this . eventEmitter . emit ( XMPPEvents . ROOM_DISCO_INFO_FAILED , error ) ;
639644 } ,
640645 IQ_TIMEOUT ) ;
@@ -694,10 +699,20 @@ export default class ChatRoom extends Listenable {
694699 formSubmit . c ( 'field' , { 'var' : 'muc#roomconfig_whois' } )
695700 . c ( 'value' ) . t ( 'anyone' ) . up ( ) . up ( ) ;
696701
697- this . connection . sendIQ ( formSubmit ) ;
702+ this . connection . sendIQ ( formSubmit , undefined , error => {
703+ handleStropheError ( error , {
704+ operation : 'submit room configuration form' ,
705+ roomJid : this . roomjid ,
706+ userJid : this . connection . jid
707+ } ) ;
708+ } ) ;
698709
699710 } , error => {
700- logger . error ( 'Error getting room configuration form: ' , error ) ;
711+ handleStropheError ( error , {
712+ operation : 'get room configuration form' ,
713+ roomJid : this . roomjid ,
714+ userJid : this . connection . jid
715+ } ) ;
701716 } ) ;
702717 }
703718
@@ -1618,7 +1633,15 @@ export default class ChatRoom extends Listenable {
16181633 this . connection . sendIQ (
16191634 grantIQ ,
16201635 result => logger . info ( 'Set affiliation of participant with jid: ' , jid , 'to' , affiliation , result ) ,
1621- error => logger . error ( 'Set affiliation of participant error: ' , error ) ) ;
1636+ error => {
1637+ handleStropheError ( error , {
1638+ affiliation,
1639+ operation : 'set affiliation of participant' ,
1640+ participantJid : jid ,
1641+ roomJid : this . roomjid ,
1642+ userJid : this . connection . jid
1643+ } ) ;
1644+ } ) ;
16221645 }
16231646
16241647 /**
@@ -1637,7 +1660,15 @@ export default class ChatRoom extends Listenable {
16371660 this . connection . sendIQ (
16381661 kickIQ ,
16391662 result => logger . info ( 'Kick participant with jid: ' , jid , result ) ,
1640- error => logger . error ( 'Kick participant error: ' , error ) , undefined ) ;
1663+ error => {
1664+ handleStropheError ( error , {
1665+ operation : 'kick participant' ,
1666+ participantJid : jid ,
1667+ reason,
1668+ roomJid : this . roomjid ,
1669+ userJid : this . connection . jid
1670+ } ) ;
1671+ } , undefined ) ;
16411672 }
16421673
16431674 /* eslint-disable max-params */
@@ -1722,12 +1753,26 @@ export default class ChatRoom extends Listenable {
17221753 this . password = key ;
17231754 onSuccess ( ) ;
17241755 } ,
1725- onError ) ;
1756+ error => {
1757+ handleStropheError ( error , {
1758+ operation : 'lock room (submit form)' ,
1759+ roomJid : this . roomjid ,
1760+ userJid : this . connection . jid
1761+ } ) ;
1762+ onError ( error ) ;
1763+ } ) ;
17261764 } else {
17271765 onNotSupported ( ) ;
17281766 }
17291767 } ,
1730- onError ) ;
1768+ error => {
1769+ handleStropheError ( error , {
1770+ operation : 'lock room (get configuration)' ,
1771+ roomJid : this . roomjid ,
1772+ userJid : this . connection . jid
1773+ } ) ;
1774+ onError ( error ) ;
1775+ } ) ;
17311776 }
17321777
17331778 /* eslint-enable max-params */
@@ -1759,7 +1804,13 @@ export default class ChatRoom extends Listenable {
17591804 }
17601805 } ) ;
17611806
1762- sendIq && this . xmpp . connection . sendIQ ( affiliationsIq . up ( ) ) ;
1807+ sendIq && this . xmpp . connection . sendIQ ( affiliationsIq . up ( ) , undefined , error => {
1808+ handleStropheError ( error , {
1809+ operation : 'set members affiliation' ,
1810+ roomJid : this . roomjid ,
1811+ userJid : this . xmpp . connection . jid
1812+ } ) ;
1813+ } ) ;
17631814 }
17641815 // eslint-disable-next-line @typescript-eslint/no-empty-function
17651816 const errorCallback = onError ? onError : ( ) => { } ;
@@ -1806,12 +1857,28 @@ export default class ChatRoom extends Listenable {
18061857 . up ( ) ;
18071858 }
18081859
1809- this . xmpp . connection . sendIQ ( formToSubmit , onSuccess , errorCallback ) ;
1860+ this . xmpp . connection . sendIQ ( formToSubmit , onSuccess , error => {
1861+ handleStropheError ( error , {
1862+ enabled,
1863+ operation : 'set members only (submit form)' ,
1864+ roomJid : this . roomjid ,
1865+ userJid : this . xmpp . connection . jid
1866+ } ) ;
1867+ errorCallback ( error ) ;
1868+ } ) ;
18101869 } else {
18111870 errorCallback ( new Error ( 'Setting members only room not supported!' ) ) ;
18121871 }
18131872 } ,
1814- errorCallback ) ;
1873+ error => {
1874+ handleStropheError ( error , {
1875+ enabled,
1876+ operation : 'set members only (get configuration)' ,
1877+ roomJid : this . roomjid ,
1878+ userJid : this . xmpp . connection . jid
1879+ } ) ;
1880+ errorCallback ( error ) ;
1881+ } ) ;
18151882 }
18161883
18171884
@@ -2105,7 +2172,16 @@ export default class ChatRoom extends Listenable {
21052172 this . connection . sendIQ (
21062173 iqToFocus ,
21072174 result => logger . info ( 'set mute' , result ) ,
2108- error => logger . error ( 'set mute error' , error ) ) ;
2175+ error => {
2176+ handleStropheError ( error , {
2177+ mediaType,
2178+ mute,
2179+ operation : 'set mute participant' ,
2180+ participantJid : jid ,
2181+ roomJid : this . roomjid ,
2182+ userJid : this . connection . jid
2183+ } ) ;
2184+ } ) ;
21092185 }
21102186
21112187 /**
@@ -2305,7 +2381,15 @@ export default class ChatRoom extends Listenable {
23052381
23062382 resolve ( this . cachedShortTermCredentials [ service ] ) ;
23072383 } ,
2308- reject ) ;
2384+ error => {
2385+ handleStropheError ( error , {
2386+ operation : 'get short term credentials' ,
2387+ roomJid : this . roomjid ,
2388+ service,
2389+ userJid : this . connection . jid
2390+ } ) ;
2391+ reject ( error ) ;
2392+ } ) ;
23092393 } ) ;
23102394 }
23112395}
0 commit comments