This isn't really an answer to your question yet, as what you're doing should work. This is some advice that might help you debug what's happening. Here, I'm replacing any errors you get (from either stream) with a new error and a custom message. If an error is thrown, it will get printed to the console.
this.myService.requestOne(this.data).pipe(
catchError(err => throwError(new Error("Request One Error"))),
mergeMap(dataOne =>
this.myService.requestTwo(dataOne).pipe(
catchError(err => throwError(new Error("Request Two Error")))
)
)
).subscribe({
next: _ => console.log("Stream Emission"),
complete: () => console.log("Stream Completed"),
error: err => console.log(err.message)
});
If you're not getting "Request Two Error"
, that means requestTwo
is not throwing an error and your problem is elsewhere. If you get "Stream Completed"
, then your code ran without throwing an error.