generator function promised wrapper