Skip to content

Commit

Permalink
fix(ads): Fixed conditional to display properly fatal errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rafa8626 committed Dec 7, 2020
1 parent 11918cc commit 77c24bb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
6 changes: 4 additions & 2 deletions dist/esm/media/ads.js
Expand Up @@ -332,8 +332,10 @@ class Ads {
console.warn(`Ad warning: ${error.toString()}`);
}
else {
if (this.adsManager && fatalErrorCodes.indexOf(error.getErrorCode()) > -1) {
this.adsManager.destroy();
if (fatalErrorCodes.indexOf(error.getErrorCode()) > -1) {
if (this.adsManager) {
this.adsManager.destroy();
}
console.error(`Ad error: ${error.toString()}`);
}
else {
Expand Down
7 changes: 5 additions & 2 deletions dist/openplayer.js
Expand Up @@ -9379,8 +9379,11 @@ var Ads = function () {
this.load(true);
console.warn("Ad warning: ".concat(error.toString()));
} else {
if (this.adsManager && fatalErrorCodes.indexOf(error.getErrorCode()) > -1) {
this.adsManager.destroy();
if (fatalErrorCodes.indexOf(error.getErrorCode()) > -1) {
if (this.adsManager) {
this.adsManager.destroy();
}

console.error("Ad error: ".concat(error.toString()));
} else {
console.warn("Ad warning: ".concat(error.toString()));
Expand Down
2 changes: 1 addition & 1 deletion dist/openplayer.min.js

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions src/js/media/ads.ts
Expand Up @@ -774,8 +774,10 @@ class Ads {
console.warn(`Ad warning: ${error.toString()}`);
} else {
// Unless there's a fatal error, do not destroy the Ads manager
if (this.adsManager && fatalErrorCodes.indexOf(error.getErrorCode()) > -1) {
this.adsManager.destroy();
if (fatalErrorCodes.indexOf(error.getErrorCode()) > -1) {
if (this.adsManager) {
this.adsManager.destroy();
}
console.error(`Ad error: ${error.toString()}`);
} else {
console.warn(`Ad warning: ${error.toString()}`);
Expand Down

0 comments on commit 77c24bb

Please sign in to comment.