From a77f0bf9b350efb03f32dd54d8712a90a9fbab5f Mon Sep 17 00:00:00 2001 From: Arne Tarara Date: Wed, 18 Sep 2024 15:40:36 +0200 Subject: [PATCH] Trying to catch TimeoutError --- energy-tests/nextcloud_install.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/energy-tests/nextcloud_install.py b/energy-tests/nextcloud_install.py index 8e439905..b9f79477 100644 --- a/energy-tests/nextcloud_install.py +++ b/energy-tests/nextcloud_install.py @@ -50,11 +50,13 @@ def main(browser_name: str = "chromium"): log_note(f"Exception occurred: {e.message}") # set a timeout. Since the call to page.content() is blocking we need to defer it to the OS - signal.signal(signal.SIGALRM, timeout_handler) - signal.alarm(20) - log_note(f"Page content was: {page.content()}") - signal.alarm(0) # remove timeout signal - + try: + signal.signal(signal.SIGALRM, timeout_handler) + signal.alarm(20) + log_note(f"Page content was: {page.content()}") + signal.alarm(0) # remove timeout signal + except TimeoutError as exc: + raise e from exc raise e