tcontinuexc.nim 520 B

12345678910111213141516171819202122232425262728293031
  1. discard """
  2. file: "tcontinuexc.nim"
  3. outputsub: "ECcaught"
  4. exitcode: "1"
  5. """
  6. type
  7. ESomething = object of Exception
  8. ESomeOtherErr = object of Exception
  9. proc genErrors(s: string) =
  10. if s == "error!":
  11. raise newException(ESomething, "Test")
  12. else:
  13. raise newException(EsomeotherErr, "bla")
  14. try:
  15. for i in 0..3:
  16. try:
  17. genErrors("error!")
  18. except ESomething:
  19. stdout.write("E")
  20. stdout.write("C")
  21. raise newException(EsomeotherErr, "bla")
  22. finally:
  23. echo "caught"
  24. #OUT ECcaught