diff --git a/monkey/infection_monkey/master/automated_master.py b/monkey/infection_monkey/master/automated_master.py index 0ef31129c..5586e808c 100644 --- a/monkey/infection_monkey/master/automated_master.py +++ b/monkey/infection_monkey/master/automated_master.py @@ -225,8 +225,10 @@ class AutomatedMaster(IMaster): interrupted_message = f"Received a stop signal, skipping remaining {plugin_type}s" for p in interruptible_iter(plugins, self._stop, interrupted_message): - # TODO: Catch exceptions to prevent thread from crashing - callback(p) + try: + callback(p) + except Exception as ex: + logger.debug(f"Exception encountered when running {plugin_type} {p}: {str(ex)}") logger.info(f"Finished running {plugin_type}s")