@@ -415,10 +415,9 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
415415 env = addItemToEnvelope ( env , createAttachmentEnvelopeItem ( attachment ) ) ;
416416 }
417417
418- const promise = this . sendEnvelope ( env ) ;
419- if ( promise ) {
420- promise . then ( sendResponse => this . emit ( 'afterSendEvent' , event , sendResponse ) , null ) ;
421- }
418+ // sendEnvelope should not throw
419+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
420+ this . sendEnvelope ( env ) . then ( sendResponse => this . emit ( 'afterSendEvent' , event , sendResponse ) ) ;
422421 }
423422
424423 /**
@@ -876,16 +875,18 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
876875 public sendEnvelope ( envelope : Envelope ) : PromiseLike < TransportMakeRequestResponse > {
877876 this . emit ( 'beforeEnvelope' , envelope ) ;
878877
879- if ( this . _isEnabled ( ) && this . _transport ) {
880- return this . _transport . send ( envelope ) . then ( null , reason => {
881- DEBUG_BUILD && debug . error ( 'Error while sending envelope:' , reason ) ;
882- return reason ;
883- } ) ;
878+ if ( ! this . _isEnabled ( ) || ! this . _transport ) {
879+ DEBUG_BUILD && debug . error ( 'Transport disabled' ) ;
880+ return resolvedSyncPromise ( { } ) ;
884881 }
885882
886- DEBUG_BUILD && debug . error ( 'Transport disabled' ) ;
887-
888- return resolvedSyncPromise ( { } ) ;
883+ return this . _transport . send ( envelope ) . then (
884+ response => response ,
885+ reason => {
886+ DEBUG_BUILD && debug . error ( 'Error while sending envelope:' , reason ) ;
887+ return { } ;
888+ } ,
889+ ) ;
889890 }
890891
891892 /* eslint-enable @typescript-eslint/unified-signatures */
0 commit comments