import asyncdispatch
proc bar(): Future[string] {.async.} =
await sleepAsync(100)
if true:
raise newException(OSError, "hall")
proc foo(): Future[string] {.async.} = return await bar()
echo waitFor(foo())
Results in:
a2.nim(11) a2
asyncdispatch.nim(1204) waitFor
asyncdispatch.nim(1253) poll
asyncdispatch.nim(181) processPendingCallbacks
asyncmacro.nim(34) cb0
a2.nim(7) barIter
[[reraised from:
a2.nim(11) a2
asyncdispatch.nim(1204) waitFor
asyncdispatch.nim(1253) poll
asyncdispatch.nim(181) processPendingCallbacks
asyncmacro.nim(34) cb0
asyncmacro.nim fooIter
asyncfutures.nim(311) read
]]
[[reraised from:
a2.nim(11) a2
asyncdispatch.nim(1612) waitFor
asyncfutures.nim(311) read
]]
Error: unhandled exception:
Async traceback
---------------
a2.nim(11) a2
asyncdispatch.nim(1204) waitFor
asyncdispatch.nim(1253) poll
asyncdispatch.nim(181) processPendingCallbacks
asyncmacro.nim(34) cb0
a2.nim(7) barIter
Exception message: hall
Definitely different on devel (I'm working on improving async stack traces).
Note the asyncdispatch.nim(1204) waitFor, it points to the proc poll definition.
This is likely related to #5617.
This issue makes it very hard to dig into problems we encounter in production logs. Is it hard to fix?
I was planning to look into async stack traces after #7770 is merged, asyncmacro is simplified and await turned to a template.
Most helpful comment
I was planning to look into async stack traces after #7770 is merged,
asyncmacrois simplified andawaitturned to a template.