enhancement for 'usage' message
authorJF Ding <Jian-feng.Ding@intel.com>
Fri, 2 Sep 2011 02:22:11 +0000 (11:22 +0900)
committerJF Ding <Jian-feng.Ding@intel.com>
Fri, 2 Sep 2011 02:22:11 +0000 (11:22 +0900)
mic/utils/errors.py
tools/mic

index 5dd7793e93b70d4bb8105914291693500a6bc9da..9cf80d07156fe97bd95a82a23009e8643b34f021 100644 (file)
@@ -24,14 +24,17 @@ class CreatorError(Exception):
         self.msg = msg
 
     def __str__(self):
-        return self.keyword + repr(self.msg)
-
-class ConfigError(CreatorError):
-    keyword = '<config>'
+        return self.keyword + str(self.msg)
 
 class Usage(CreatorError):
     keyword = '<usage>'
 
+    def __str__(self):
+        return self.keyword + str(self.msg) + ', please use "--help" for more info'
+
+class ConfigError(CreatorError):
+    keyword = '<config>'
+
 class KsError(CreatorError):
     keyword = '<kickstart>'
 
index e63ab28c6ba4ea6b78412e218dc449753a0007ff..79914c1f4b9e159a08bb7801bf34cd1d0e28b721 100755 (executable)
--- a/tools/mic
+++ b/tools/mic
@@ -167,8 +167,10 @@ if __name__ == "__main__":
     try:
         mic = Mic()
         sys.exit(mic.main())
+    except errors.Usage, usage:
+        msger.error(str(usage))
 
-    except (errors.Usage, errors.ConfigError, errors.CreatorError) as err:
+    except errors.ConfigError, err:
         if msger.get_loglevel() == 'debug':
             import traceback
             msger.error(traceback.format_exc())