From 6ebe2e391b5644490baf317ee442b301ddffafa2 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Tue, 14 Sep 2021 16:54:06 +0200 Subject: [PATCH] Island: Add more exceptions to get_deployment_from_file --- monkey/monkey_island/cc/services/version_update.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/monkey/monkey_island/cc/services/version_update.py b/monkey/monkey_island/cc/services/version_update.py index 0430ba5be..b9255232e 100644 --- a/monkey/monkey_island/cc/services/version_update.py +++ b/monkey/monkey_island/cc/services/version_update.py @@ -78,7 +78,13 @@ class VersionUpdateService: with open(file_path, "r") as deployment_info_file: deployment_info = json.load(deployment_info_file) deployment = deployment_info["deployment"] + except FileNotFoundError as ex: + logger.debug(f"Deployment file {file_path} is not found. Exception: {ex}") + except KeyError as ex: + logger.debug(f"Invalid key in the deployment file. Exception: {ex}") + except json.JSONDecodeError as ex: + logger.debug(f"Invalid deployment info file. Exception: {ex}") except Exception as ex: - logger.debug(f"Couldn't get deployment info from {file_path}. Exception: {str(ex)}.") + logger.debug(f"Couldn't get deployment info from {file_path}. Exception: {ex}.") return deployment