From: Phillip Berndt Date: Mon, 12 Jan 2015 09:39:28 +0000 (+0100) Subject: Python version: Better error message for missing profiles X-Git-Tag: 1.0~108 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=02e9fd58b6d07d3a6a484e6c1e293354b8b638ba;p=deb_pkgs%2Fautorandr.git Python version: Better error message for missing profiles --- diff --git a/autorandr.py b/autorandr.py index e7ab988..fd18b15 100755 --- a/autorandr.py +++ b/autorandr.py @@ -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")