Skip to content

Commit 87ad5aa

Browse files
committed
catch mongodb unknown errors
1 parent 8487b72 commit 87ad5aa

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

OpenFlow/src/DatabaseConnection.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ export class DatabaseConnection {
4040
return;
4141
}
4242
this.cli = await MongoClient.connect(this.mongodburl, { autoReconnect: false, useNewUrlParser: true });
43+
this.cli.on("error", (error) => {
44+
this._logger.error(error);
45+
});
4346
this.db = this.cli.db(this._dbname);
4447
}
4548

0 commit comments

Comments
 (0)