错误是否被认为是 RxJs 中 Observable 的发射?
Is Error Considered an Emission from an Observable in RxJs?
小问题:出现错误时 .do()
会关闭吗?文档说,"Perform a side effect for every emission on the source Observable, but return an Observable that is identical to the source." 错误也被认为是排放吗?
return this.authHttp.get(url)
.delay(5000)
.map(this.extractData)
.do(() => console.log("I'm doing something"))
.share()
.catch(error => {
if (isDev) this.toastr.error("The panels could not be retrieved from the API.");
return this.handleEerror(error);
});
没有。
事实上,管道中的所有内容都被跳过,直到捕获。
.do()
method 可以采用可选的 onError
回调来处理错误:
observable
.do(
value => console.log("I'm doing something"),
err => console.error('I got an error', err.stack)
)
...否则它只会通过管道。
小问题:出现错误时 .do()
会关闭吗?文档说,"Perform a side effect for every emission on the source Observable, but return an Observable that is identical to the source." 错误也被认为是排放吗?
return this.authHttp.get(url)
.delay(5000)
.map(this.extractData)
.do(() => console.log("I'm doing something"))
.share()
.catch(error => {
if (isDev) this.toastr.error("The panels could not be retrieved from the API.");
return this.handleEerror(error);
});
没有。
事实上,管道中的所有内容都被跳过,直到捕获。
.do()
method 可以采用可选的 onError
回调来处理错误:
observable
.do(
value => console.log("I'm doing something"),
err => console.error('I got an error', err.stack)
)
...否则它只会通过管道。