How to catch str exception?
google at mrabarnett.plus.com
Fri May 15 16:17:15 CEST 2009
anuraguniyal at yahoo.com wrote:
> but the whole point of catching such exception is that i can print its
> there are many such exceptions and hence it is not feasible to catch
> them all or know them all unless i go thru src code.
If string exceptions are so difficult to use, don't use them! :-)
It would be better to write your own exception class:
raise MyException("Something bad happened!")
except MyException, e:
print "ERROR: %s" % e
More information about the Python-list