mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
31 lines
482 B
Nim
31 lines
482 B
Nim
discard """
|
|
outputsub: "-6"
|
|
"""
|
|
type
|
|
ESomething = object of E_Base
|
|
ESomeOtherErr = object of E_Base
|
|
|
|
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()
|
|
|
|
|