summary refs log tree commit diff stats
path: root/tests/bind/mbind3.nim
Commit message (Expand)AuthorAgeFilesLines
* Remove expr/stmt (#5857)Arne Döring2017-07-251-1/+1
* tests: Trim .nim files trailing whitespaceAdam Strzelecki2015-09-041-1/+1
* new tester; all tests categorizedAraq2014-01-131-0/+10
7302a8ce7 ^
a13a14327 ^






















7302a8ce7 ^






a13a14327 ^
7302a8ce7 ^





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 """
  outputsub: "-6"
"""
type
  ESomething = object of Exception
  ESomeOtherErr = object of Exception
  ESomethingGen[T] = object of Exception
  ESomethingGenRef[T] = ref object of Exception

proc genErrors(s: string) =
  if s == "error!":
    raise newException(ESomething, "Test")
  else:
    raise newException(EsomeotherErr, "bla")

proc raiseBla(): int =
  try:
    genErrors("errssor!")
  except ESomething:
    echo("Error happened")
  except:
    raise

proc blah(): int =
  try:
    result = raiseBla()
  except ESomeOtherErr:
    result = -6

echo blah()

# Issue #7845, raise generic exception
var x: ref ESomethingGen[int]
new(x)
try:
  raise x
except ESomethingGen[int] as e:
  discard

try:
  raise new(ESomethingGenRef[int])
except ESomethingGenRef[int] as e:
  discard
except:
  discard