From 962cf6b25e622ffc23094a50c934dfc9bb4c82ce Mon Sep 17 00:00:00 2001 From: DhivaharM <104612614+DhivaharM@users.noreply.github.com> Date: Wed, 13 Nov 2024 17:00:13 +0530 Subject: [PATCH] sentry issue fix (#577) --- src/lib/client.ts | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/lib/client.ts b/src/lib/client.ts index 862dd31e..51227fe2 100644 --- a/src/lib/client.ts +++ b/src/lib/client.ts @@ -461,12 +461,14 @@ export class Client extends EventEmitter { /* istanbul ignore next */ upload.on('error', e => { if (this.forwardErrors) { - Sentry.setTag('filestack-apikey', this.session.apikey); - Sentry.setTag('filestack-version', Utils.getVersion()); - Sentry.setExtra('filestack-options', this.options); - Sentry.setExtras({ uploadOptions: options, storeOptions, details: e.details }); - e.message = `FS-${e.message}`; - Sentry.captureException(e); + Sentry.withScope(scope => { + scope.setTag('filestack-apikey', this.session.apikey); + scope.setTag('filestack-version', Utils.getVersion()); + scope.setExtra('filestack-options', this.options); + scope.setExtras({ uploadOptions: options, storeOptions, details: e.details }); + e.message = `FS-${e.message}`; + scope.captureException(e); + }); } this.emit('upload.error', e); @@ -523,11 +525,15 @@ export class Client extends EventEmitter { upload.on('start', () => this.emit('upload.start')); /* istanbul ignore next */ upload.on('error', e => { - Sentry.setTag('filestack-apikey', this.session.apikey); - Sentry.setTag('filestack-version', Utils.getVersion()); - Sentry.setExtra('filestack-options', this.options); - Sentry.setExtras({ uploadOptions: options, storeOptions, details: e.details }); - Sentry.captureException(e); + Sentry.withScope(scope => { + scope.setTag('filestack-apikey', this.session.apikey); + scope.setTag('filestack-version', Utils.getVersion()); + scope.setExtra('filestack-options', this.options); + scope.setExtras(e.details); + scope.setExtras({ uploadOptions: options, storeOptions }); + scope.captureException(e); + }); + this.emit('upload.error', e); });