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'返回一個新的流只是工作? –