tnestedreturn2.nim 424 B

123456789101112131415161718192021
  1. discard """
  2. file: "tnestedreturn2.nim"
  3. outputsub: "Error: unhandled exception: Problem [OSError]"
  4. exitcode: "1"
  5. """
  6. proc test4() =
  7. try:
  8. try:
  9. raise newException(OSError, "Problem")
  10. except OSError:
  11. return
  12. finally:
  13. discard
  14. # Should cause unhandled exception error,
  15. # but could cause segmentation fault if
  16. # exceptions are not handled properly.
  17. test4()
  18. raise newException(OSError, "Problem")