Refactored some repeated code in coroutine.
Renamed sendValue/Error to emitValue/Error.