Island: Crash if deployment cannot be determined

This commit is contained in:
Mike Salvatore 2022-08-03 14:24:46 -04:00
parent 449207876f
commit 833e3b82bc
1 changed files with 7 additions and 8 deletions

View File

@ -158,14 +158,13 @@ def _get_depyloyment_from_file(file_path: Path) -> Deployment:
with open(file_path, "r") as deployment_info_file: with open(file_path, "r") as deployment_info_file:
deployment_info = json.load(deployment_info_file) deployment_info = json.load(deployment_info_file)
return Deployment[deployment_info["deployment"].upper()] return Deployment[deployment_info["deployment"].upper()]
except FileNotFoundError as ex: except KeyError as err:
logger.debug(f"Deployment file {file_path} is not found. Exception: {ex}") raise Exception(
except KeyError as ex: f"The deployment file ({file_path}) did not contain the expected data: "
logger.debug(f"Invalid key in the deployment file. Exception: {ex}") f"missing key {err}"
except json.JSONDecodeError as ex: )
logger.debug(f"Invalid deployment info file. Exception: {ex}") except Exception as err:
except Exception as ex: raise Exception(f"Failed to fetch the deployment from {file_path}: {err}")
logger.debug(f"Couldn't get deployment info from {file_path}. Exception: {ex}.")
def _register_services(container: DIContainer): def _register_services(container: DIContainer):