Just to be 100% clear I’ll repeat what I wrote earlier: coroutines run in protected mode. Any error inside the coroutine will be caught and returned from the call to coroutine.resume(). Like this:
local co = coroutine.create(function()
print("before")
msg.post("this:/is#broken", "foobar") -- this will not work and the coroutine will catch the error and return it to the call to coroutine.resume()
print("after")
end)
local ok, err = coroutine.resume(co)
if not ok then
print(err) -- the error message generated by the broken msg.post() will be output here
end