diff --git a/dist/ShowJSError.d.ts b/dist/ShowJSError.d.ts index 9798a5a..e1d1a0e 100644 --- a/dist/ShowJSError.d.ts +++ b/dist/ShowJSError.d.ts @@ -3,6 +3,7 @@ export interface ShowJSErrorSettings { reportUrl?: string; templateDetailedMessage?: string; size?: 'big' | 'normal'; + errorFilter?: (error: ExtendedError) => boolean; } export interface ShowJSErrorElems { actions: HTMLDivElement; diff --git a/dist/show-js-error.esm.js b/dist/show-js-error.esm.js index cf16099..fceebed 100644 --- a/dist/show-js-error.esm.js +++ b/dist/show-js-error.esm.js @@ -212,9 +212,13 @@ var ShowJSError = /** @class */ (function () { size: settings.size || 'normal', reportUrl: settings.reportUrl || '', templateDetailedMessage: settings.templateDetailedMessage || '', + errorFilter: settings.errorFilter || function () { return true; }, }; }; ShowJSError.prototype.pushError = function (error) { + if (!this.settings.errorFilter(error)) { + return; + } this.state.errorBuffer.push(error); this.state.errorIndex = this.state.errorBuffer.length - 1; this.updateUI(); diff --git a/dist/show-js-error.js b/dist/show-js-error.js index 61b7422..2c15979 100644 --- a/dist/show-js-error.js +++ b/dist/show-js-error.js @@ -215,9 +215,13 @@ size: settings.size || 'normal', reportUrl: settings.reportUrl || '', templateDetailedMessage: settings.templateDetailedMessage || '', + errorFilter: settings.errorFilter || function () { return true; }, }; }; ShowJSError.prototype.pushError = function (error) { + if (!this.settings.errorFilter(error)) { + return; + } this.state.errorBuffer.push(error); this.state.errorIndex = this.state.errorBuffer.length - 1; this.updateUI();