From fe792ffc6fc5bd091c5a5456fc3d1b573d2b6ac3 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Mon, 29 Aug 2022 19:45:35 +0530 Subject: [PATCH] Island: Catch ValueError and TypeError instead of InvalidConfigurationError in resource AgentConfiguration's PUT --- monkey/monkey_island/cc/resources/agent_configuration.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/monkey/monkey_island/cc/resources/agent_configuration.py b/monkey/monkey_island/cc/resources/agent_configuration.py index e96ed5df2..297c8c79f 100644 --- a/monkey/monkey_island/cc/resources/agent_configuration.py +++ b/monkey/monkey_island/cc/resources/agent_configuration.py @@ -5,7 +5,6 @@ from flask import make_response, request from common.agent_configuration.agent_configuration import ( AgentConfiguration as AgentConfigurationObject, ) -from common.agent_configuration.agent_configuration import InvalidConfigurationError from monkey_island.cc.repository import IAgentConfigurationRepository from monkey_island.cc.resources.AbstractResource import AbstractResource from monkey_island.cc.resources.request_authentication import jwt_required @@ -30,7 +29,7 @@ class AgentConfiguration(AbstractResource): self._agent_configuration_repository.store_configuration(configuration_object) # API Spec: Should return 204 (NO CONTENT) return make_response({}, 200) - except (InvalidConfigurationError, json.JSONDecodeError) as err: + except (ValueError, TypeError, json.JSONDecodeError) as err: return make_response( {"error": f"Invalid configuration supplied: {err}"}, 400,