tgotoexceptions5.nim 639 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. discard """
  2. output: '''
  3. before
  4. swallowed
  5. before
  6. swallowed B
  7. '''
  8. cmd: "nim c --gc:arc --exceptions:goto -d:ssl $file"
  9. """
  10. # bug #13599
  11. proc main() =
  12. try:
  13. echo "before"
  14. raise newException(CatchableError, "foo")
  15. except AssertionDefect:
  16. echo "caught"
  17. echo "after"
  18. try:
  19. main()
  20. except:
  21. echo "swallowed"
  22. proc mainB() =
  23. try:
  24. echo "before"
  25. raise newException(CatchableError, "foo")
  26. # except CatchableError: # would work
  27. except AssertionDefect:
  28. echo "caught"
  29. except:
  30. raise
  31. echo "after"
  32. try:
  33. mainB()
  34. except:
  35. echo "swallowed B"
  36. # bug #14647
  37. import httpclient
  38. newAsyncHttpClient().close()