From rxjs 5.5, catch
has been renamed to catchError
function to avoid name clash.
Due to having operators available independent of an Observable, operator names cannot conflict with JavaScript keyword restrictions. Therefore the names of the pipeable version of some operators have changed.
import { catchError } from 'rxjs/operators';
For throw
you can use ErrorObservable
.
import { ErrorObservable } from 'rxjs/observable/ErrorObservable';
ErrorObservable.create(new Error("oops"));
rxjs 6
Instead of ErrorObservable use throwError.
import { throwError } from 'rxjs'
throwError(new Error("oops"));
Also you will now have to pipe the operators instead of directly chaining them to the observable
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…