File tree Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -22,23 +22,23 @@ export abstract class MongoDBToolBase extends ToolBase {
22
22
) ;
23
23
}
24
24
25
- if ( this . config . connectionString ) {
26
- try {
27
- await this . connectToMongoDB ( this . config . connectionString ) ;
28
- } catch ( error ) {
29
- logger . error (
30
- LogId . mongodbConnectFailure ,
31
- "mongodbTool" ,
32
- `Failed to connect to MongoDB instance using the connection string from the config: ${ error as string } `
33
- ) ;
34
- throw new MongoDBError ( ErrorCodes . MisconfiguredConnectionString , "Not connected to MongoDB." ) ;
35
- }
25
+ if ( ! this . config . connectionString ) {
26
+ throw new MongoDBError ( ErrorCodes . NotConnectedToMongoDB , "Not connected to MongoDB" ) ;
36
27
}
37
28
38
- throw new MongoDBError ( ErrorCodes . NotConnectedToMongoDB , "Not connected to MongoDB" ) ;
29
+ try {
30
+ await this . connectToMongoDB ( this . config . connectionString ) ;
31
+ } catch ( error ) {
32
+ logger . error (
33
+ LogId . mongodbConnectFailure ,
34
+ "mongodbTool" ,
35
+ `Failed to connect to MongoDB instance using the connection string from the config: ${ error as string } `
36
+ ) ;
37
+ throw new MongoDBError ( ErrorCodes . MisconfiguredConnectionString , "Not connected to MongoDB." ) ;
38
+ }
39
39
}
40
40
41
- return this . session . serviceProvider ;
41
+ return this . session . serviceProvider ! ;
42
42
}
43
43
44
44
protected handleError (
You can’t perform that action at this time.
0 commit comments