Island: Rename MongoDB*Exception -> MongoDB*Error

This commit is contained in:
Mike Salvatore 2021-08-03 10:12:17 -04:00
parent dbf1ad86bc
commit c368fd6a99
2 changed files with 6 additions and 6 deletions

View File

@ -99,7 +99,7 @@ def _start_mongodb(data_dir: Path) -> MongoDbProcess:
def _connect_to_mongodb(data_dir: Path, mongo_db_process: MongoDbProcess):
try:
mongo_setup.connect_to_mongodb()
except mongo_setup.MongoDBTimeOutException as ex:
except mongo_setup.MongoDBTimeOutError as ex:
if mongo_db_process and not mongo_db_process.is_running():
logger.error(
f"Failed to start MongoDB process. Check log at {mongo_db_process.log_file}."
@ -107,7 +107,7 @@ def _connect_to_mongodb(data_dir: Path, mongo_db_process: MongoDbProcess):
else:
logger.error(ex)
sys.exit(1)
except mongo_setup.MongoDBVersionException as ex:
except mongo_setup.MongoDBVersionError as ex:
logger.error(ex)
sys.exit(1)

View File

@ -56,7 +56,7 @@ def _wait_for_mongo_db_server(mongo_url):
logger.info(f"Waiting for MongoDB server on {mongo_url}")
if (time.time() - start_time) > TIMEOUT:
raise MongoDBTimeOutException(f"Failed to connect to MongoDB after {TIMEOUT} seconds.")
raise MongoDBTimeOutError(f"Failed to connect to MongoDB after {TIMEOUT} seconds.")
time.sleep(1)
@ -70,16 +70,16 @@ def _assert_mongo_db_version(mongo_url):
required_version = tuple(MINIMUM_MONGO_DB_VERSION_REQUIRED.split("."))
server_version = get_db_version(mongo_url)
if server_version < required_version:
raise MongoDBVersionException(
raise MongoDBVersionError(
f"Mongo DB version too old. {required_version} is required, but got {server_version}."
)
else:
logger.info(f"Mongo DB version OK. Got {server_version}")
class MongoDBTimeOutException(Exception):
class MongoDBTimeOutError(Exception):
pass
class MongoDBVersionException(Exception):
class MongoDBVersionError(Exception):
pass