I have two observable calls relying on each other, this works fine, but once an error occurs in the response I need to call another observable which rolls the transaction back.
ZThat is my code:
return this.myService.createOrder()
.pipe(
concatMap((res: MyResponse) => this.addProduct(res.orderId, PRODUCT_ID))
).subscribe({
error: (error: any): void => // TODO: Call another observable here passing res.orderId to rollback transaction
});
As you can see in the TODO my plan is to call another service when an error occurs with res.orderId, but I don't like having nested subscriptions.
Is it possible to do that without creating nested subscriptions???