[jhbuild] Fix display of error message on non-command guessing of module name



commit 0aabd235a90f8b71613ab9fb50877d2f7fdae799
Author: FrÃdÃric PÃters <fpeters 0d be>
Date:   Tue Oct 18 15:07:03 2011 +0200

    Fix display of error message on non-command guessing of module name

 jhbuild/commands/__init__.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/jhbuild/commands/__init__.py b/jhbuild/commands/__init__.py
index 6b84367..4f368f3 100644
--- a/jhbuild/commands/__init__.py
+++ b/jhbuild/commands/__init__.py
@@ -117,9 +117,10 @@ def run(command, config, args, help):
     if command not in _commands:
         import jhbuild.moduleset
         module_set = jhbuild.moduleset.load(config)
-        if module_set.get_module(command):
+        try:
+            module_set.get_module(command)
             raise FatalError(_('no such command (did you mean "jhbuild build %s"?)' % command))
-        else:
+        except KeyError:
             raise FatalError(_('no such command (did you mean "jhbuild run %s"?)' % command))
 
     command_class = _commands[command]



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