diff --git a/monkey/infection_monkey/island_api_client/http_island_api_client.py b/monkey/infection_monkey/island_api_client/http_island_api_client.py index d1e13778b..819b774d0 100644 --- a/monkey/infection_monkey/island_api_client/http_island_api_client.py +++ b/monkey/infection_monkey/island_api_client/http_island_api_client.py @@ -35,14 +35,8 @@ def handle_island_errors(fn): def decorated(*args, **kwargs): try: return fn(*args, **kwargs) - except ( - IslandAPIConnectionError, - IslandAPIError, - IslandAPIRequestError, - IslandAPIRequestFailedError, - IslandAPITimeoutError, - ) as e: - raise e + except IslandAPIError as err: + raise err except (requests.exceptions.ConnectionError, requests.exceptions.TooManyRedirects) as err: raise IslandAPIConnectionError(err) except requests.exceptions.HTTPError as err: @@ -67,8 +61,8 @@ def convert_json_error_to_island_api_error(fn): def wrapper(*args, **kwargs): try: fn(*args, **kwargs) - except json.JSONDecodeError as e: - raise IslandAPIRequestFailedError(e) + except json.JSONDecodeError as err: + raise IslandAPIRequestFailedError(err) return wrapper