Receiving `UnhandledPromiseRejectionWarning` even though rejected promise is handled
I have constructed a function which iterates through a Generator containing both synchronous code and Promises : module.exports = { isPromise (value) { return typeof value === 'object' && value !== null && 'then' in value; }, runGen (generatorFunc, startValue) { let that = this, i = 0; function *iterator(resolve, reject) { let runGeneratorFunc = generatorFunc(startValue), yieldedOut = {done: false}, yieldIn; while (!yieldedOut.done) { console.log(i++, 'Ready for next iteration'); if (that.isPromise(yieldedOut.value)) { console.log(i++, 'Pass promise to KeepIterating'); yieldIn = yield