diff --git a/packages/@webex/internal-plugin-mercury/src/mercury.js b/packages/@webex/internal-plugin-mercury/src/mercury.js index ed7b706130c..25d0a7bbc69 100644 --- a/packages/@webex/internal-plugin-mercury/src/mercury.js +++ b/packages/@webex/internal-plugin-mercury/src/mercury.js @@ -391,10 +391,12 @@ const Mercury = WebexPlugin.extend({ try { this.trigger(...args); } catch (error) { - this.logger.error(`${this.namespace}: error occurred in event handler`, { + this.logger.error( + `${this.namespace}: error occurred in event handler:`, error, - arguments: args, - }); + ' with args: ', + args + ); } }, diff --git a/packages/@webex/internal-plugin-mercury/test/unit/spec/mercury.js b/packages/@webex/internal-plugin-mercury/test/unit/spec/mercury.js index 6e772c301b9..275cc9c8494 100644 --- a/packages/@webex/internal-plugin-mercury/test/unit/spec/mercury.js +++ b/packages/@webex/internal-plugin-mercury/test/unit/spec/mercury.js @@ -706,10 +706,13 @@ describe('plugin-mercury', () => { sinon.stub(mercury.logger, 'error'); return Promise.resolve(mercury._emit('break', event)).then((res) => { - assert.calledWith(mercury.logger.error, 'Mercury: error occurred in event handler', { + assert.calledWith( + mercury.logger.error, + 'Mercury: error occurred in event handler:', error, - arguments: ['break', event], - }); + ' with args: ', + ['break', event] + ); return res; }); }); diff --git a/packages/@webex/plugin-meetings/src/locus-info/parser.ts b/packages/@webex/plugin-meetings/src/locus-info/parser.ts index 135f62c9325..3d9ff4c20f9 100644 --- a/packages/@webex/plugin-meetings/src/locus-info/parser.ts +++ b/packages/@webex/plugin-meetings/src/locus-info/parser.ts @@ -771,7 +771,14 @@ export default class Parser { )}, Action: ${lociComparison}` ); - this.onDeltaAction(lociComparison, newLoci); + try { + this.onDeltaAction(lociComparison, newLoci); + } catch (error) { + LoggerProxy.logger.error( + 'Locus-info:parser#processDeltaEvent --> Error in onDeltaAction', + error + ); + } } this.nextEvent(); diff --git a/packages/@webex/plugin-meetings/test/unit/spec/locus-info/index.js b/packages/@webex/plugin-meetings/test/unit/spec/locus-info/index.js index 359788cccb5..599f5a6f389 100644 --- a/packages/@webex/plugin-meetings/test/unit/spec/locus-info/index.js +++ b/packages/@webex/plugin-meetings/test/unit/spec/locus-info/index.js @@ -1807,6 +1807,35 @@ describe('plugin-meetings', () => { assert.calledWith(locusInfo.applyLocusDeltaData, action, parsedLoci, fakeMeeting); }); + it('catches errors thrown by onDeltaAction and is able to process next Locus delta', () => { + const fakeLocusDelta = { + sequence: { + rangeStart: 0, + rangeEnd: 0, + }, + }; + locusInfo.locusParser.workingCopy = { + sequence: { + rangeStart: 0, + rangeEnd: 0, + }, + }; + const testMeeting = {locusInfo: {onDeltaLocus: sinon.stub()}}; + + locusParser.onDeltaAction = sandbox + .stub() + .onCall(0) + .callsFake(() => { + throw new Error('fake error'); + }); + + // simulate first locus delta coming - it will trigger an error thrown by onDeltaAction + locusInfo.handleLocusDelta(fakeLocusDelta, testMeeting); + + // simulate a second locus delta coming - it should be processed without errors + locusInfo.handleLocusDelta(fakeLocusDelta, testMeeting); + }); + it('applyLocusDeltaData handles USE_INCOMING action correctly', () => { const {USE_INCOMING} = LocusDeltaParser.loci; const meeting = {