]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/commitdiff
Python version: Better error message for missing profiles
authorPhillip Berndt <phillip.berndt@googlemail.com>
Mon, 12 Jan 2015 09:39:28 +0000 (10:39 +0100)
committerPhillip Berndt <phillip.berndt@googlemail.com>
Mon, 12 Jan 2015 09:39:28 +0000 (10:39 +0100)
autorandr.py

index e7ab98866c93c47aa7efa2bfd904ba9a95f29abe..fd18b15e42360b1ff5060682cab54657b04c656e 100755 (executable)
@@ -526,7 +526,11 @@ def main(argv):
         if load_profile in ( x[0] for x in virtual_profiles ):
             profile = generate_virtual_profile(config, modes, load_profile)
         else:
-            profile = profiles[load_profile]
+            try:
+                profile = profiles[load_profile]
+            except KeyError:
+                print("Failed to load profile '%s':\nProfile not found" % load_profile, file=sys.stderr)
+                sys.exit(1)
         add_unused_outputs(config, profile)
         if profile == config and not "-f" in options and not "--force" in options:
             print("Config already loaded")