File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -101,12 +101,17 @@ export class ConnectClusterTool extends AtlasToolBase {
101
101
cn . searchParams . set ( "authSource" , "admin" ) ;
102
102
const connectionString = cn . toString ( ) ;
103
103
104
+ let lastError : Error | undefined = undefined ;
105
+
104
106
for ( let i = 0 ; i < 20 ; i ++ ) {
105
107
try {
106
108
await this . session . connectToMongoDB ( connectionString , this . config . connectOptions ) ;
107
109
break ;
108
110
} catch ( err : unknown ) {
109
111
const error = err instanceof Error ? err : new Error ( String ( err ) ) ;
112
+
113
+ lastError = error ;
114
+
110
115
logger . debug (
111
116
LogId . atlasConnectFailure ,
112
117
"atlas-connect-cluster" ,
@@ -117,6 +122,10 @@ export class ConnectClusterTool extends AtlasToolBase {
117
122
}
118
123
}
119
124
125
+ if ( lastError ) {
126
+ throw lastError ;
127
+ }
128
+
120
129
return {
121
130
content : [
122
131
{
You can’t perform that action at this time.
0 commit comments