Skip to content

Commit

Permalink
feat(FEC-8297): reset plugin on critical error (#4)
Browse files Browse the repository at this point in the history
Stop report on critical error
  • Loading branch information
Dan Ziv authored Jun 11, 2018
1 parent 0252c59 commit 3a86cea
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/kava.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import {BasePlugin, FakeEvent} from 'playkit-js'
import {BasePlugin, Error as PKError, FakeEvent} from 'playkit-js'
import {OVPAnalyticsService} from 'playkit-js-providers/dist/playkit-analytics-service'
import {KavaEventModel} from './kava-event-model'
import KavaRateHandler from './kava-rate-handler'
Expand Down Expand Up @@ -297,6 +297,9 @@ export default class Kava extends BasePlugin {
_onError(event: FakeEvent): void {
this._model.updateModel({errorCode: event.payload.code});
this._sendAnalytics(KavaEventModel.ERROR);
if (event.payload && (event.payload.severity === PKError.Severity.CRITICAL)) {
this.reset();
}
}

_onPlayerStateChanged(event: FakeEvent): void {
Expand Down

0 comments on commit 3a86cea

Please sign in to comment.