Skip to content

Commit

Permalink
Import connection failure
Browse files Browse the repository at this point in the history
  • Loading branch information
hawesie committed Feb 20, 2018
1 parent 1e5aecc commit c2b0eb9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mongodb_store/src/mongodb_store/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from mongodb_store_msgs.msg import SerialisedMessage
from mongodb_store_msgs.srv import MongoQueryMsgRequest

from pymongo.errors import ConnectionFailure

import importlib
from datetime import datetime

Expand All @@ -33,7 +35,7 @@ def check_connection_to_mongod(db_host, db_port):
client = MongoClient(db_host, db_port, connect=False)
result = client.admin.command('ismaster')
return True
except pymongo.errors.ConnectionFailure:
except ConnectionFailure:
rospy.logerr("Could not connect to mongo server %s:%d" % (db_host, db_port))
rospy.logerr("Make sure mongod is launched on your specified host/port")
return False
Expand Down

0 comments on commit c2b0eb9

Please sign in to comment.