As much as I comprehend, the OP asks why coroutine.resume does not throw an error, rather than coroutine.wrap. Otherwise, in contrast, do they ask whether the function returned by coroutine.wrap does error without wait?
I’m guessing OP is wondering why the error in the output trace the error back to test then in the coroutine before coroutine.resume(...). Tou can make the error trace go back by specifying a number to the second argument of error.
i wan’t to error goes from coroutine.wrap or coroutine.resume but i test this things and find out that is if there is any yield (for any time) it will use error() function from test() function. Specifying a ENV level doesn’t help.