From e3afe4de77f812a0a617b7907c82ba29d3a3e5a6 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Sun, 10 Aug 2008 15:49:02 +0100 Subject: [PATCH] * hugdaylist: Added code to handle exceptions. --- debian/changelog | 1 + hugdaylist | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index f58c649..4d1adee 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,7 @@ ubuntu-dev-tools (0.36ubuntu1) intrepid; urgency=low - grab-attachment.1. * doc/requestsync.1: Described variables used by requestsync in man page. (LP: #237595) + * hugdaylist: Added code to handle exceptions. [ Siegfried-Angel Gevatter Pujals ] * Change the versioning scheme from 0.XX to 0.XXubuntu1. Delete diff --git a/hugdaylist b/hugdaylist index 555e112..85c2a86 100755 --- a/hugdaylist +++ b/hugdaylist @@ -21,9 +21,9 @@ try: import launchpadbugs.connector as Connector BugList = Connector.ConnectBugList() Bug = Connector.ConnectBug(method="Text") -except: +except ImportError: print >> sys.stderr, \ - "You need python-launchpad-bugs (>= 0.2.25) installed to use hugdaylist." + "You need python-launchpad-bugs (>= 0.2.25) installed to use hugdaylist." sys.exit(1) @@ -38,7 +38,10 @@ def check_args(): sys.exit(1) if sys.argv[1] == "-n": - howmany = int(sys.argv[2]) + try: + howmany = int(sys.argv[2]) + except IndexError: + print "Option '-n' requires a number." if len(sys.argv) < 4: print USAGE sys.exit(1) @@ -82,5 +85,8 @@ def main(): if __name__ == '__main__': - main() - + try: + main() + except KeyboardInterrupt: + print >> sys.stderr, "Aborted" + sys.exit(1)