@@ -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