Island: Rename ex -> err in server_setup.py

This commit is contained in:
Mike Salvatore 2022-08-12 10:55:25 -04:00
parent dd30b61658
commit 1873ce3bfe
1 changed files with 10 additions and 10 deletions

View File

@ -59,24 +59,24 @@ def run_monkey_island():
def _extract_config(island_args: IslandCmdArgs) -> IslandConfigOptions: def _extract_config(island_args: IslandCmdArgs) -> IslandConfigOptions:
try: try:
return get_server_config(island_args) return get_server_config(island_args)
except json.JSONDecodeError as ex: except json.JSONDecodeError as err:
print(f"Error loading server config: {ex}") print(f"Error loading server config: {err}")
sys.exit(1) sys.exit(1)
def _setup_data_dir(data_dir_path: Path): def _setup_data_dir(data_dir_path: Path):
try: try:
setup_data_dir(data_dir_path) setup_data_dir(data_dir_path)
except IncompatibleDataDirectory as ex: except IncompatibleDataDirectory as err:
print(f"Incompatible data directory: {ex}") print(f"Incompatible data directory: {err}")
sys.exit(1) sys.exit(1)
def _exit_on_invalid_config_options(config_options: IslandConfigOptions): def _exit_on_invalid_config_options(config_options: IslandConfigOptions):
try: try:
island_config_options_validator.raise_on_invalid_options(config_options) island_config_options_validator.raise_on_invalid_options(config_options)
except Exception as ex: except Exception as err:
print(f"Configuration error: {ex}") print(f"Configuration error: {err}")
sys.exit(1) sys.exit(1)
@ -107,16 +107,16 @@ def _start_mongodb(data_dir: Path) -> MongoDbProcess:
def _connect_to_mongodb(mongo_db_process: MongoDbProcess): def _connect_to_mongodb(mongo_db_process: MongoDbProcess):
try: try:
mongo_setup.connect_to_mongodb(MONGO_CONNECTION_TIMEOUT) mongo_setup.connect_to_mongodb(MONGO_CONNECTION_TIMEOUT)
except mongo_setup.MongoDBTimeOutError as ex: except mongo_setup.MongoDBTimeOutError as err:
if mongo_db_process and not mongo_db_process.is_running(): if mongo_db_process and not mongo_db_process.is_running():
logger.error( logger.error(
f"Failed to start MongoDB process. Check log at {mongo_db_process.log_file}." f"Failed to start MongoDB process. Check log at {mongo_db_process.log_file}."
) )
else: else:
logger.error(ex) logger.error(err)
sys.exit(1) sys.exit(1)
except mongo_setup.MongoDBVersionError as ex: except mongo_setup.MongoDBVersionError as err:
logger.error(ex) logger.error(err)
sys.exit(1) sys.exit(1)