Skip to content

Commit 3ec7255

Browse files
committed
fix: log flex error
1 parent 21bd018 commit 3ec7255

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/common/atlas/cluster.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ClusterDescription20240805, FlexClusterDescription20241113 } from "./openapi.js";
22
import { ApiClient } from "./apiClient.js";
3+
import logger, { LogId } from "../../logger.js";
34

45
export interface Cluster {
56
name?: string;
@@ -85,7 +86,9 @@ export async function inspectCluster(apiClient: ApiClient, projectId: string, cl
8586
},
8687
});
8788
return formatFlexCluster(cluster);
88-
} catch {
89+
} catch (flexError) {
90+
const err = flexError instanceof Error ? flexError : new Error(String(flexError));
91+
logger.error(LogId.atlasInspectFailure, "inspect-cluster", `error inspecting cluster: ${err.message}`);
8992
throw error;
9093
}
9194
}

src/logger.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const LogId = {
1313
atlasCheckCredentials: mongoLogId(1_001_001),
1414
atlasDeleteDatabaseUserFailure: mongoLogId(1_001_002),
1515
atlasConnectFailure: mongoLogId(1_001_003),
16+
atlasInspectFailure: mongoLogId(1_001_004),
1617

1718
telemetryDisabled: mongoLogId(1_002_001),
1819
telemetryEmitFailure: mongoLogId(1_002_002),

0 commit comments

Comments
 (0)