summary refs log tree commit diff stats
path: root/tests/destructor/tgotoexceptions5.nim
blob: 695aab0a401bb6e5ec8c696b0c8e5015a5ad3be1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
discard """
  output: '''
before
swallowed
before
swallowed B
'''
  cmd: "nim c --gc:arc --exceptions:goto -d:ssl $file"
"""

# bug #13599
proc main() =
  try:
    echo "before"
    raise newException(CatchableError, "foo")
  except AssertionDefect:
    echo "caught"
  echo "after"

try:
  main()
except:
  echo "swallowed"

proc mainB() =
  try:
    echo "before"
    raise newException(CatchableError, "foo")
  # except CatchableError: # would work
  except AssertionDefect:
    echo "caught"
  except:
    raise
  echo "after"

try:
  mainB()
except:
  echo "swallowed B"

# bug #14647
import httpclient

newAsyncHttpClient().close()