[ https://issues.apache.org/jira/browse/RYA-427?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16317288#comment-16317288 ]
ASF GitHub Bot commented on RYA-427: ------------------------------------ Github user kchilton2 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/261#discussion_r160278437 --- Diff: extras/shell/src/main/java/org/apache/rya/shell/RyaConnectionCommands.java --- @@ -199,6 +199,14 @@ public void run() { } }); + try { + //attempt to get the connection point, essentially pinging mongo server. + adminClient.getConnectPoint(); + } catch (MongoException e) { + //unable to reach the mongo server, throw expected failed exception. + throw new IOException(e); --- End diff -- Instead of rethrowing the exception, could you return with a message explaining what went wrong? Not connecting to a Mongo DB because it was not there isn't an exceptional state when you're in the shell. By returning early, the connection commands will still be presented to the user. The message could be something like, "Could not connect to the specified Mongo DB." You also need to close the adminClient that was just made before returning. > Connect to mongo command in the shell should fail if unable to connect > ---------------------------------------------------------------------- > > Key: RYA-427 > URL: https://issues.apache.org/jira/browse/RYA-427 > Project: Rya > Issue Type: Bug > Reporter: Andrew Smith > Assignee: Andrew Smith > -- This message was sent by Atlassian JIRA (v6.4.14#64029)