@@ -26,12 +26,12 @@ export type ConnectionStringAuthType = "scram" | "ldap" | "kerberos" | OIDCConne
2626export interface ConnectionState {
2727 tag : ConnectionTag ;
2828 connectionStringAuthType ?: ConnectionStringAuthType ;
29+ connectedAtlasCluster ?: AtlasClusterConnectionInfo ;
2930}
3031
3132export interface ConnectionStateConnected extends ConnectionState {
3233 tag : "connected" ;
3334 serviceProvider : NodeDriverServiceProvider ;
34- connectedAtlasCluster ?: AtlasClusterConnectionInfo ;
3535}
3636
3737export interface ConnectionStateConnecting extends ConnectionState {
@@ -104,7 +104,11 @@ export class ConnectionManager extends EventEmitter<ConnectionManagerEvents> {
104104 } ) ;
105105 } catch ( error : unknown ) {
106106 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+ } ) ;
108112 throw new MongoDBError ( ErrorCodes . MisconfiguredConnectionString , errorReason ) ;
109113 }
110114
@@ -119,7 +123,11 @@ export class ConnectionManager extends EventEmitter<ConnectionManagerEvents> {
119123 } ) ;
120124 } catch ( error : unknown ) {
121125 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+ } ) ;
123131 throw new MongoDBError ( ErrorCodes . NotConnectedToMongoDB , errorReason ) ;
124132 }
125133 }
0 commit comments