t509.py 405 B

123456789101112131415161718192021222324
  1. try:
  2. raise TypeError, "abc"
  3. except TypeError as e:
  4. print "caught", e
  5. try:
  6. try:
  7. raise TypeError("abc")
  8. except TypeError as e:
  9. print "caught", e
  10. raise
  11. except TypeError as e:
  12. print "caught re-raise: ", e
  13. try:
  14. raise TypeError
  15. except TypeError as e:
  16. print "caught", e
  17. try:
  18. x = TypeError("abc")
  19. raise x
  20. except TypeError as e:
  21. print "caught", e