Author: andar
Revision: 5671
Log:
Show an error instead of crashing when trying to use a command option
without a required argument
Diff:
Modified: trunk/deluge/ui/console/main.py
===================================================================
--- trunk/deluge/ui/console/main.py 2009-08-17 18:02:56 UTC (rev 5670)
+++ trunk/deluge/ui/console/main.py 2009-08-17 19:13:09 UTC (rev 5671)
@@ -86,7 +86,7 @@
If you override this in a subclass, it should not return -- it
should either exit or raise an exception.
"""
- raise
+ raise Exception(msg)
class BaseCommand(object):
@@ -266,7 +266,12 @@
parser._print_help(f)
parser.print_help = print_help
- options, args = parser.parse_args(args)
+ try:
+ options, args = parser.parse_args(args)
+ except Exception, e:
+ self.write("{!error!}Error parsing options: %s" % e)
+ return
+
if not getattr(options, '_exit', False):
try:
ret = self._commands[cmd].handle(*args, **options.__dict__)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---