summary refs log tree commit diff stats
path: root/tests/exception/tshow_real_exception_name.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/exception/tshow_real_exception_name.nim')
-rw-r--r--tests/exception/tshow_real_exception_name.nim28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/exception/tshow_real_exception_name.nim b/tests/exception/tshow_real_exception_name.nim
new file mode 100644
index 000000000..1a708dbd6
--- /dev/null
+++ b/tests/exception/tshow_real_exception_name.nim
@@ -0,0 +1,28 @@
+discard """
+  outputsub: "CustomChildError"
+  exitcode: 1
+"""
+
+type
+  CustomError* = object of Exception
+  CustomChildError* = object of CustomError
+
+  FutureBase* = ref object of RootObj
+    error*: ref Exception
+
+  Future*[T] = ref object of FutureBase
+    v: T
+
+proc fail[T](future: Future[T], error: ref Exception) =
+  future.error = error
+
+proc w1(): Future[int] =
+  result = Future[int]()
+  result.fail(newException(CustomChildError, "abc"))
+
+proc main =
+  var fut = w1()
+  if true:
+    raise fut.error
+
+main()