I am using coroutine for some time expensive code. The code uses coroutine.yield() from time to time to let the client continue. That works fine.
However I sometimes introduce bugs in the code which can happen inside the coroutine.
coroutine.resume(cr) returns false, errormessage in this case. Thats great. Im currently using something like this:
local errorFree, errorMessage = coroutine.resume(self.layoutCoroutine, self)
assert(errorFree, errorMessage)
Which does almost the right thing: If an error occurs in the coroutine, I get the error message, including the file and line. However I do not get the stacktrace of the error.
Does anyone know how to get the actual stacktrace?
However I sometimes introduce bugs in the code which can happen inside the coroutine.
coroutine.resume(cr) returns false, errormessage in this case. Thats great. Im currently using something like this:
Which does almost the right thing: If an error occurs in the coroutine, I get the error message, including the file and line. However I do not get the stacktrace of the error.
Does anyone know how to get the actual stacktrace?
If there are no errors, a/b/c will get the values passed to yield() or returned by the completed main body.
If there's an error, you can use debugstack(self.layoutCoroutine) to get the stack trace.