From 19937467f4248c1ebf57741d3d156571fa408d05 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 29 Apr 2021 13:42:15 +0200 Subject: [PATCH] be explicit in exception --- igniter/tools.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/igniter/tools.py b/igniter/tools.py index 3c133afcb8..55ea4b98e9 100644 --- a/igniter/tools.py +++ b/igniter/tools.py @@ -14,7 +14,11 @@ from pathlib import Path import platform from pymongo import MongoClient -from pymongo.errors import ServerSelectionTimeoutError, InvalidURI +from pymongo.errors import ( + ServerSelectionTimeoutError, + InvalidURI, + ConfigurationError +) def decompose_url(url: str) -> Dict: @@ -139,7 +143,7 @@ def validate_mongo_connection(cnx: str) -> (bool, str): return False, f"Invalid port specified {parsed.port}" except InvalidURI as e: return False, str(e) - except Exception as exc: + except ConfigurationError as exc: return False, str(exc) else: return True, "Connection is successful"