Skip to content

Commit 962cf6b

Browse files
DhivaharMsethk4783
authored andcommitted
sentry issue fix (#577)
1 parent 1fc32ac commit 962cf6b

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

src/lib/client.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -461,12 +461,14 @@ export class Client extends EventEmitter {
461461
/* istanbul ignore next */
462462
upload.on('error', e => {
463463
if (this.forwardErrors) {
464-
Sentry.setTag('filestack-apikey', this.session.apikey);
465-
Sentry.setTag('filestack-version', Utils.getVersion());
466-
Sentry.setExtra('filestack-options', this.options);
467-
Sentry.setExtras({ uploadOptions: options, storeOptions, details: e.details });
468-
e.message = `FS-${e.message}`;
469-
Sentry.captureException(e);
464+
Sentry.withScope(scope => {
465+
scope.setTag('filestack-apikey', this.session.apikey);
466+
scope.setTag('filestack-version', Utils.getVersion());
467+
scope.setExtra('filestack-options', this.options);
468+
scope.setExtras({ uploadOptions: options, storeOptions, details: e.details });
469+
e.message = `FS-${e.message}`;
470+
scope.captureException(e);
471+
});
470472
}
471473

472474
this.emit('upload.error', e);
@@ -523,11 +525,15 @@ export class Client extends EventEmitter {
523525
upload.on('start', () => this.emit('upload.start'));
524526
/* istanbul ignore next */
525527
upload.on('error', e => {
526-
Sentry.setTag('filestack-apikey', this.session.apikey);
527-
Sentry.setTag('filestack-version', Utils.getVersion());
528-
Sentry.setExtra('filestack-options', this.options);
529-
Sentry.setExtras({ uploadOptions: options, storeOptions, details: e.details });
530-
Sentry.captureException(e);
528+
Sentry.withScope(scope => {
529+
scope.setTag('filestack-apikey', this.session.apikey);
530+
scope.setTag('filestack-version', Utils.getVersion());
531+
scope.setExtra('filestack-options', this.options);
532+
scope.setExtras(e.details);
533+
scope.setExtras({ uploadOptions: options, storeOptions });
534+
scope.captureException(e);
535+
});
536+
531537
this.emit('upload.error', e);
532538
});
533539

0 commit comments

Comments
 (0)