From c2b0eb96cb7b5afed0988dbe15619f2156bd9050 Mon Sep 17 00:00:00 2001 From: Nick Hawes Date: Tue, 20 Feb 2018 09:08:49 +0000 Subject: [PATCH] Import connection failure --- mongodb_store/src/mongodb_store/util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mongodb_store/src/mongodb_store/util.py b/mongodb_store/src/mongodb_store/util.py index 5048a33..ebab174 100644 --- a/mongodb_store/src/mongodb_store/util.py +++ b/mongodb_store/src/mongodb_store/util.py @@ -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 @@ -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