diff --git a/monkey/infection_monkey/exploit/HostExploiter.py b/monkey/infection_monkey/exploit/HostExploiter.py index 69924b61a..0f698c926 100644 --- a/monkey/infection_monkey/exploit/HostExploiter.py +++ b/monkey/infection_monkey/exploit/HostExploiter.py @@ -82,16 +82,16 @@ class HostExploiter: self.options = options self.pre_exploit() - result = None try: - result = self._exploit_host() + return self._exploit_host() except FailedExploitationError as e: logger.debug(f"Exploiter failed: {e}.") - except Exception: + raise e + except Exception as e: logger.error("Exception in exploit_host", exc_info=True) + raise e finally: self.post_exploit() - return result def pre_exploit(self): self.exploit_result = ExploiterResultData(