I am migrating to rxjs 6.0.0-ucandoit-rc.6
. In version 5.5.2
I was using ErrorObservable
to create errorous observable.
I was using the way recommended here: https://github.com/ReactiveX/rxjs/blob/master/doc/pipeable-operators.md
Because throw is a key word you could use _throw after import { _throw } from 'rxjs/observable/throw'.
However this is not recommended way to import in rxjs6 anymore.
What is correct way how to import _throw
or ErrorObservable
?
In order to retry the failed observable immediately after the error occurs, all we have to do is return the Errors Observable without any further changes. res => console. log('HTTP response', res), err => console.
A Pipeable Operator is a function that takes an Observable as its input and returns another Observable. It is a pure operation: the previous Observable stays unmodified. A Pipeable Operator is essentially a pure function which takes one Observable as input and generates another Observable as output.
In RxJS version 6, _throw
has been renamed to throwError
and should be imported like this:
import { throwError } from "rxjs";
Alternatively, you can install rxjs-compat
alongside rxjs
version 6 to continue to use the old, version 5 exports:
import { _throw } from "rxjs/observable/throw";
For more information, see the migration guide.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With