class AutomationTimeoutError(Exception):
# Custom exception for test framework timeouts
passdef execute_with_cleanup(action_fn, cleanup_fn):
try:
action_fn()
except Exception as e:
print(f"Action failed: {e}")
raise AutomationTimeoutError(f"Step failed: {e}") from e
finally:
cleanup_fn()