How to except the unexpected?
jstroud at ucla.edu
Sat Mar 4 22:19:29 CET 2006
Rene Pijlman wrote:
> Steven D'Aprano:
>>ExpectedErrors = (URLError, IOError)
>> print "Congratulations! You have found a program bug!"
>> print "For a $327.68 reward, please send the following " \
>> "traceback to Professor Donald Knuth."
>> print "An unexpected error occurred."
>> print "This probably means the Internet is broken."
>> print "If the bug still occurs after fixing the Internet, " \
>> "it may be a program bug."
> Yes, I think I'll do something like this. Perhaps combined with Peter's
> advice to not micromanage, like so:
> Reraise = (LookupError, ArithmeticError, AssertionError) # And then some
> except Reraise:
Why catch an error only to re-raise it?
This falls under http://c2.com/cgi/wiki?YouReallyArentGonnaNeedThis
More information about the Python-list