tshow_real_exception_name.nim 517 B

1234567891011121314151617181920212223242526272829
  1. discard """
  2. outputsub: "CustomChildError"
  3. exitcode: 1
  4. """
  5. type
  6. CustomError* = object of Exception
  7. CustomChildError* = object of CustomError
  8. FutureBase* = ref object of RootObj
  9. error*: ref Exception
  10. Future*[T] = ref object of FutureBase
  11. v: T
  12. proc fail[T](future: Future[T], error: ref Exception) =
  13. future.error = error
  14. proc w1(): Future[int] =
  15. result = Future[int]()
  16. result.fail(newException(CustomChildError, "abc"))
  17. proc main =
  18. var fut = w1()
  19. if true:
  20. raise fut.error
  21. main()