Skip to content

Commit 003520f

Browse files
committed
fix: don't log an error if aborting device ID resolution
1 parent 00b572c commit 003520f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/logging/src/logging-and-telemetry.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,13 @@ export class LoggingAndTelemetry implements MongoshLoggingAndTelemetry {
141141
const getMachineId = require('native-machine-id').getMachineId;
142142
this.deviceId = await getDeviceId({
143143
getMachineId: () => getMachineId({ raw: true }),
144-
onError: (_, error) =>
145-
this.bus.emit('mongosh:error', error, 'telemetry'),
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+
},
146151
abortSignal: this.telemetrySetup.signal,
147152
});
148153
}

0 commit comments

Comments
 (0)