@@ -26,12 +26,12 @@ export type ConnectionStringAuthType = "scram" | "ldap" | "kerberos" | OIDCConne
26
26
export interface ConnectionState {
27
27
tag : ConnectionTag ;
28
28
connectionStringAuthType ?: ConnectionStringAuthType ;
29
+ connectedAtlasCluster ?: AtlasClusterConnectionInfo ;
29
30
}
30
31
31
32
export interface ConnectionStateConnected extends ConnectionState {
32
33
tag : "connected" ;
33
34
serviceProvider : NodeDriverServiceProvider ;
34
- connectedAtlasCluster ?: AtlasClusterConnectionInfo ;
35
35
}
36
36
37
37
export interface ConnectionStateConnecting extends ConnectionState {
@@ -104,7 +104,11 @@ export class ConnectionManager extends EventEmitter<ConnectionManagerEvents> {
104
104
} ) ;
105
105
} catch ( error : unknown ) {
106
106
const errorReason = error instanceof Error ? error . message : `${ error as string } ` ;
107
- this . changeState ( "connection-errored" , { tag : "errored" , errorReason } ) ;
107
+ this . changeState ( "connection-errored" , {
108
+ tag : "errored" ,
109
+ errorReason,
110
+ connectedAtlasCluster : settings . atlas ,
111
+ } ) ;
108
112
throw new MongoDBError ( ErrorCodes . MisconfiguredConnectionString , errorReason ) ;
109
113
}
110
114
@@ -119,7 +123,11 @@ export class ConnectionManager extends EventEmitter<ConnectionManagerEvents> {
119
123
} ) ;
120
124
} catch ( error : unknown ) {
121
125
const errorReason = error instanceof Error ? error . message : `${ error as string } ` ;
122
- this . changeState ( "connection-errored" , { tag : "errored" , errorReason } ) ;
126
+ this . changeState ( "connection-errored" , {
127
+ tag : "errored" ,
128
+ errorReason,
129
+ connectedAtlasCluster : settings . atlas ,
130
+ } ) ;
123
131
throw new MongoDBError ( ErrorCodes . NotConnectedToMongoDB , errorReason ) ;
124
132
}
125
133
}
0 commit comments