@@ -96,7 +96,7 @@ export class LoggingAndTelemetry implements MongoshLoggingAndTelemetry {
96
96
/** @internal Used for awaiting the telemetry setup in tests. */
97
97
public setupTelemetryPromise : Promise < void > = Promise . resolve ( ) ;
98
98
99
- private readonly telemetrySetup : AbortController = new AbortController ( ) ;
99
+ private readonly telemetrySetupAbort : AbortController = new AbortController ( ) ;
100
100
101
101
constructor ( {
102
102
bus,
@@ -132,7 +132,7 @@ export class LoggingAndTelemetry implements MongoshLoggingAndTelemetry {
132
132
133
133
// Abort setup, which will cause the device ID to be set to 'unknown'
134
134
// and run any remaining telemetry events
135
- this . telemetrySetup . abort ( ) ;
135
+ this . telemetrySetupAbort . abort ( ) ;
136
136
}
137
137
138
138
private async setupTelemetry ( ) : Promise < void > {
@@ -141,9 +141,14 @@ export class LoggingAndTelemetry implements MongoshLoggingAndTelemetry {
141
141
const getMachineId = require ( 'native-machine-id' ) . getMachineId ;
142
142
this . deviceId = await getDeviceId ( {
143
143
getMachineId : ( ) => getMachineId ( { raw : true } ) ,
144
- onError : ( _ , error ) =>
145
- this . bus . emit ( 'mongosh:error' , error , 'telemetry' ) ,
146
- abortSignal : this . telemetrySetup . signal ,
144
+ onError : ( reason , error ) => {
145
+ if ( reason === 'abort' ) {
146
+ return ;
147
+ }
148
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
149
+ this . bus . emit ( 'mongosh:error' , error , 'telemetry' ) ;
150
+ } ,
151
+ abortSignal : this . telemetrySetupAbort . signal ,
147
152
} ) ;
148
153
}
149
154
0 commit comments