diff options
author | W. Trevor King <wking@drexel.edu> | 2009-07-10 14:11:23 -0400 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2009-07-10 14:11:23 -0400 |
commit | 0f09cef7c497ea826df526d2d3a5b018279c4d2f (patch) | |
tree | ba198d2d478cc4f65184f9069b74c1a8570cd35a /be | |
parent | e5c0d5f2f3f7637cad6baca9e33778d0c054195d (diff) | |
download | bugseverywhere-0f09cef7c497ea826df526d2d3a5b018279c4d2f.tar.gz |
Simplified error handling in ./be
Removed superfluous nesting in ./be's error catching. Also replaced
KeyErrors due to unknown commands with the more specific
cmdutil.UnknownCommand, since all sorts of programming errors can
raise KeyErrors.
Untested, since my working tree is a mess at the moment, but what
could go wrong? ;)
Diffstat (limited to 'be')
-rwxr-xr-x | be | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -35,21 +35,21 @@ elif sys.argv[1] == '--version': print _version.version_info["revision_id"] else: try: - try: - sys.exit(cmdutil.execute(sys.argv[1], sys.argv[2:])) - except KeyError, e: - raise cmdutil.UserError("Unknown command \"%s\"" % e.args[0]) - except cmdutil.GetHelp: - print cmdutil.help(sys.argv[1]) - sys.exit(0) - except cmdutil.GetCompletions, e: - print '\n'.join(e.completions) - sys.exit(0) - except cmdutil.UsageError, e: - print "Invalid usage:", e - print "\nArgs:", sys.argv[1:] - print cmdutil.help(sys.argv[1]) - sys.exit(1) + sys.exit(cmdutil.execute(sys.argv[1], sys.argv[2:])) + except cmdutil.GetHelp: + print cmdutil.help(sys.argv[1]) + sys.exit(0) + except cmdutil.GetCompletions, e: + print '\n'.join(e.completions) + sys.exit(0) + except cmdutil.UnknownCommand, e: + print e + sys.exit(1) + except cmdutil.UsageError, e: + print "Invalid usage:", e + print "\nArgs:", sys.argv[1:] + print cmdutil.help(sys.argv[1]) + sys.exit(1) except cmdutil.UserError, e: print "ERROR:" print e |