Skip to content

Commit

Permalink
Better error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
bmc committed Apr 16, 2008
1 parent 82b009a commit 9c426ed
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions fortune/__init__.py
Expand Up @@ -247,10 +247,14 @@ def main():
except KeyError:
argParser.showUsage('Missing fortune file.')

if options.update:
makeFortuneDataFile(fortuneFile)
else:
sys.stdout.write(getRandomFortune(fortuneFile))
try:
if options.update:
makeFortuneDataFile(fortuneFile)
else:
sys.stdout.write(getRandomFortune(fortuneFile))
except ValueError, msg:
print >> sys.stderr, msg
sys.exit(1)

if __name__ == '__main__':
main()

0 comments on commit 9c426ed

Please sign in to comment.