From ecbd3b2673e1503bec8c258e50e1502925a3f937 Mon Sep 17 00:00:00 2001 From: ShiKhu Date: Fri, 27 Aug 2021 09:54:52 +0300 Subject: [PATCH] fix(tracker): 3.2.5 - merge handleError and handlErrorEvent api --- tracker/tracker/package.json | 2 +- tracker/tracker/src/main/index.ts | 16 +++++----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/tracker/tracker/package.json b/tracker/tracker/package.json index 8c6f6c172..1ed351baf 100644 --- a/tracker/tracker/package.json +++ b/tracker/tracker/package.json @@ -1,7 +1,7 @@ { "name": "@openreplay/tracker", "description": "The OpenReplay tracker main package", - "version": "3.2.4", + "version": "3.2.5", "keywords": [ "logging", "replay" diff --git a/tracker/tracker/src/main/index.ts b/tracker/tracker/src/main/index.ts index e56eab6ec..79e2cbee8 100644 --- a/tracker/tracker/src/main/index.ts +++ b/tracker/tracker/src/main/index.ts @@ -225,18 +225,12 @@ export default class API { } } - handleError = (e: Error) => { - if (e instanceof Error && this.app !== null) { + handleError = (e: Error | ErrorEvent | PromiseRejectionEvent) => { + if (this.app === null) { return; } + if (e instanceof Error) { this.app.send(getExceptionMessage(e, [])); - } - } - - handleErrorEvent = (e: ErrorEvent | PromiseRejectionEvent) => { - if ( - (e instanceof ErrorEvent || - ('PromiseRejectionEvent' in window && e instanceof PromiseRejectionEvent) - ) && - this.app !== null + } else if (e instanceof ErrorEvent || + ('PromiseRejectionEvent' in window && e instanceof PromiseRejectionEvent) ) { const msg = getExceptionMessageFromEvent(e); if (msg != null) {