Files
Nim/tests/exception/treraise.nim
2015-04-19 02:43:19 +02:00

25 lines
434 B
Nim

discard """
file: "treraise.nim"
outputsub: "Error: unhandled exception: bla [ESomeOtherErr]"
exitcode: "1"
"""
type
ESomething = object of Exception
ESomeOtherErr = object of Exception
proc genErrors(s: string) =
if s == "error!":
raise newException(ESomething, "Test")
else:
raise newException(EsomeotherErr, "bla")
try:
genErrors("errssor!")
except ESomething:
echo("Error happened")
except:
raise