Skip to content

Commit

Permalink
[MongoDB Persistence] Do not use isConnected() to test the connection.
Browse files Browse the repository at this point in the history
The new method throws the real underlying exception instead of a generic one. This allows for detailed logging.

Signed-off-by: Stephan Brunner <s.brunner@stephan-brunner.net>
  • Loading branch information
boomer41 committed Apr 30, 2021
1 parent 7e5a353 commit f4bbd6f
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,7 @@ private synchronized boolean tryConnectToDatabase() {

// The mongo always succeeds in creating the connection.
// We have to actually force it to test the connection to try to connect to the server.
if (!isConnected()) {
throw new RuntimeException("Failed to connect");
}
cl.getAddress();

logger.debug("Connect MongoDB ... done");
return true;
Expand Down

0 comments on commit f4bbd6f

Please sign in to comment.