[jhbuild] Handle KeyError when modulename doesn't exist (GNOME bug 636877)



commit afbbd1664c4f6d36a6dab176e57822ab44e256ac
Author: Craig Keogh <cskeogh adam com au>
Date:   Fri Dec 10 21:45:25 2010 +1030

    Handle KeyError when modulename doesn't exist (GNOME bug 636877)

 jhbuild/commands/uninstall.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/jhbuild/commands/uninstall.py b/jhbuild/commands/uninstall.py
index 5e1570f..988c516 100644
--- a/jhbuild/commands/uninstall.py
+++ b/jhbuild/commands/uninstall.py
@@ -35,7 +35,11 @@ class cmd_uninstall(Command):
         config.set_from_cmdline_options(options)
 
         module_set = jhbuild.moduleset.load(config)
-        module_list = [module_set.get_module(modname, ignore_case = True) for modname in args]
+        try:
+            module_list = [module_set.get_module(modname, ignore_case = True) \
+                           for modname in args]
+        except KeyError:
+            raise FatalError(_('unknown module %s') % modname)
 
         if not module_list:
             self.parser.error(_('This command requires a module parameter.'))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]