From: Olli Raula Date: Wed, 23 Feb 2022 07:25:54 +0000 (+0200) Subject: Print error when user script fails X-Git-Tag: 1.13~2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=b8eb298a22cc07a54e2876f768fbcae62dde6ff6;p=deb_pkgs%2Fautorandr.git Print error when user script fails --- diff --git a/autorandr.py b/autorandr.py index 2919bb0..217b2b4 100755 --- a/autorandr.py +++ b/autorandr.py @@ -1185,8 +1185,8 @@ def exec_scripts(profile_path, script_name, meta_information=None): if os.access(script, os.X_OK | os.F_OK): try: all_ok &= subprocess.call(script, env=env) != 0 - except: - raise AutorandrException("Failed to execute user command: %s" % (script,)) + except Exception as e: + raise AutorandrException("Failed to execute user command: %s error: %s" % (script,str(e))) ran_scripts.add(script_name) script_folder = os.path.join(folder, "%s.d" % script_name) @@ -1198,8 +1198,8 @@ def exec_scripts(profile_path, script_name, meta_information=None): if os.access(script, os.X_OK | os.F_OK): try: all_ok &= subprocess.call(script, env=env) != 0 - except: - raise AutorandrException("Failed to execute user command: %s" % (script,)) + except Exception as e: + raise AutorandrException("Failed to execute user command: %s error: %s" % (script,str(e))) ran_scripts.add(check_name) return all_ok