I'm trying to make 3 sequential GET requests using RxJS ajax operator. If one of the ajax requests throws an error(404 status code, for example), the rest won't execute. Is it possible pipeline to execute all the ajax requests, even if for some of the URLs it will throw an exception?
let urls =
from
([
"http://localhost:8000/good-url", // good URL
"http://localhost:8000/wrong-url", // error 404
"http://localhost:8000/another-good-url" // good URL, ajax request won't execute
])
.pipe
(
map((url) => rxjs.ajax.ajax({
method: "GET",
url: url,
responseType: 'text'
}))
);
urls.pipe(
concatAll(),
catchError(err => { console.log("error: ", err); return rxjs.of({}); }))
.subscribe
(
response => { console.log("status: ", response.status); }
);
catchError operator is displaying the corresponding ajax error 404 info in dev tools console