PageRenderTime 39ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1.3.35/Examples/python/exception/runme.py

#
Python | 36 lines | 25 code | 9 blank | 2 comment | 12 complexity | f3bf227277495a3307735aaee22a71fe MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. # file: runme.py
  2. # Throw a lot of exceptions
  3. import example
  4. t = example.Test()
  5. try:
  6. t.unknown()
  7. except RuntimeError,e:
  8. print "incomplete type", e.args[0]
  9. try:
  10. t.simple()
  11. except RuntimeError,e:
  12. print e.args[0]
  13. try:
  14. t.message()
  15. except RuntimeError,e:
  16. print e.args[0]
  17. try:
  18. t.hosed()
  19. except example.Exc,e:
  20. print e.code, e.msg
  21. for i in range(1,4):
  22. try:
  23. t.multi(i)
  24. except RuntimeError,e:
  25. print e.args[0]
  26. except example.Exc,e:
  27. print e.code, e.msg