I need to catch errors thrown inside a stream event in promise resolution. Something like
function foo(){
return new Promise((resolve,reject) => {
resolve(res.pipe(transfomrStream).pipe(through2.obj(function(obj, enc, callback) {
on('end', ()=>{
await httpReq(...)
.then((crudRes) => assert.strictEqual(somerthing))
})
)
})
})
}
how could i catch assert failure? I've tried to return error inside the last pipe() or in function calling but i only get unhandled promise rejection