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 {
2222 ) ;
2323 }
2424
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" ) ;
3627 }
3728
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+ }
3939 }
4040
41- return this . session . serviceProvider ;
41+ return this . session . serviceProvider ! ;
4242 }
4343
4444 protected handleError (
You can’t perform that action at this time.
0 commit comments