diff options
Diffstat (limited to 'tests/exception/treraise.nim')
-rw-r--r-- | tests/exception/treraise.nim | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/exception/treraise.nim b/tests/exception/treraise.nim new file mode 100644 index 000000000..17a38aa53 --- /dev/null +++ b/tests/exception/treraise.nim @@ -0,0 +1,20 @@ +discard """ + 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 |