I have a server call which may return HTTP 202
. Influenced by this SO thread, I have the following:
this.http.get(url)
.pipe(
map(response => {
if (response.status === 202) {
throw response;
}
return response;
}),
retryWhen(errors => {
return errors.pipe(
delay(1000),
take(3),
concat(response => Observable.throw('Retries exceeded'))
);
}),
catchError(handleError)
);
Getting a deprecated
warning on the use of concat
. I understand the new concat
is in rxjs
and not rxjs/operator
.
But, what is the right way to use the new static concat
operator here?
Found the following from this site
import { concat } from 'rxjs/operators';
a$.pipe(concat(b$, c$));
// becomes
import { concat } from 'rxjs';
concat(a$, b$, c$);
I'm not able to wrap my head around which Observable
s are being concatenated in my example code?
UPDATE 1
Changed the code to:
return concat(this.http.get(url)
.pipe(
map(response => {
if (response.status === 202) {
throw response;
}
return response;
}),
retryWhen(errors => {
return errors.pipe(
delay(1000),
take(3)
);
}),
catchError(handleError)
), response => Observable.throw('Retries exceeded'));
But this results in:
core.js:1598 ERROR TypeError: You provided 'function (response) { return rxjs__WEBPACK_IMPORTED_MODULE_2__["Observable"].throw('Retries exceeded'); }' where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.
at subscribeTo (subscribeTo.js:41)
at subscribeToResult (subscribeToResult.js:6)
at