tcontinuexc.nim 491 B

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