0
比方说,我想流发出在某些情况下的错误:如何从xstream Stream上的.map()发送错误?
import xs from 'xstream'
//...
function transformBlah(blah) {
if (blah.status >= 200 && blah.status < 300) {
return blah.body
} else {
return new Error('I would like to send an error onto the Stream here')
}
}
const blahTransformed$ = xs.create(new BlahProducer())
.map(transformBlah)
https://github.com/staltz/xstream#throw – bloodyKnuckles
@bloodyKnuckles谢谢你,但是我怎么在当前Stream上做'.map'ped呢?还是从'transformBlah'返回一个新的流只是工作? –