@@ -461,12 +461,14 @@ export class Client extends EventEmitter {
461
461
/* istanbul ignore next */
462
462
upload . on ( 'error' , e => {
463
463
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
+ } ) ;
470
472
}
471
473
472
474
this . emit ( 'upload.error' , e ) ;
@@ -523,11 +525,15 @@ export class Client extends EventEmitter {
523
525
upload . on ( 'start' , ( ) => this . emit ( 'upload.start' ) ) ;
524
526
/* istanbul ignore next */
525
527
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
+
531
537
this . emit ( 'upload.error' , e ) ;
532
538
} ) ;
533
539
0 commit comments