blob: 8ed2ed0bad45ced72bfde7e910608d08db5c1b85 (
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
discard """
output: '''A
B
X
inner finally
Y
outer finally
msg1
msg2
finally2
finally1
true'''
cmd: "nim c --gc:arc $file"
"""
# bug #13668
proc main =
try:
try:
raise newException(IOError, "IOError")
except:
echo "A"
raise newException(CatchableError, "CatchableError")
except:
echo "B"
#discard
proc mainB =
try:
try:
raise newException(IOError, "IOError")
except:
echo "X"
raise newException(CatchableError, "CatchableError")
finally:
echo "inner finally"
except:
echo "Y"
#discard
finally:
echo "outer finally"
main()
mainB()
when true:
#bug 7204
proc nested_finally =
try:
raise newException(KeyError, "msg1")
except KeyError as ex:
echo ex.msg
try:
# pop exception
raise newException(ValueError, "msg2") # push: exception stack (1 entry)
except:
echo getCurrentExceptionMsg()
# pop exception (except)
finally:
echo "finally2"
# pop exception (except KeyError as ex)
finally:
echo "finally1"
nested_finally()
# bug #14925
proc test(b: bool) =
echo b
test(try: true except: false)
|