summary refs log tree commit diff stats
path: root/tests/run/tunhandledexc.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run/tunhandledexc.nim')
-rwxr-xr-xtests/run/tunhandledexc.nim23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/run/tunhandledexc.nim b/tests/run/tunhandledexc.nim
new file mode 100755
index 000000000..f24881aef
--- /dev/null
+++ b/tests/run/tunhandledexc.nim
@@ -0,0 +1,23 @@
+discard """
+  file: "tunhandledexc.nim"
+  outputsub: "Error: unhandled exception: bla [ESomeOtherErr]"
+  exitcode: "1"
+"""
+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")
+
+when True:
+  try:
+    genErrors("errssor!")
+  except ESomething:
+    echo("Error happened")
+  
+
+