Can I catch certain errors before “subscribe()” in an RXJS observable in Angular2?

前端 未结 2 1389
感动是毒
感动是毒 2021-01-18 20:44

Is it possible for a base class to catch certain errors before allowing the subclass to subscribe to the observable in Angular2.

e.g.

2条回答
  •  误落风尘
    2021-01-18 21:19

    .catch() is the right one.

    Observable is lazy, so there are no errors before you subscribe. Not sure if you mean this kind of "before" therefore I mention it just to be sure.

提交回复
热议问题