From 0c40633830d8d6f95abc12bda0d5388b52074251 Mon Sep 17 00:00:00 2001 From: Reto Kupferschmid Date: Mon, 11 Sep 2023 17:19:08 +0200 Subject: [PATCH] improove OPNsenseConfig errorhandling --- plugins/module_utils/config_utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/module_utils/config_utils.py b/plugins/module_utils/config_utils.py index 97f941e7..d0e4d4d0 100644 --- a/plugins/module_utils/config_utils.py +++ b/plugins/module_utils/config_utils.py @@ -55,6 +55,8 @@ def __exit__(self, exc_type, exc_val, exc_tb): :raises RuntimeError: If changes are present which have not been saved. :return: """ + if exc_type: + raise exc_type(f"Exception occurred: {exc_val}") if self.changed: raise RuntimeError("Config has changed. Cannot exit without saving.")