title: Setup of multi-level and dependent observables
body: <p>I am trying to implement a solution for an angular application that returns the status of a multi-level procedure and processes the result or errors that have occurred. Instead of using a common object for the status and possible errors, I would like to use two separate channels for the successful and incorrect output.<br>
  The means of choice is the Observable.throw functionality (<a href="https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/throw.md" rel="nofollow noreferrer">link</a>). The method should be called as follows: </p>
  
  <pre><code>myFunction(result).subscribe((status: boolean) =&gt; {
        console.log(data);          
      }, err =&gt; this.errorSub.next( err));
    }
  </code></pre>
  
  <p>If the procedure is completed correctly, the first method is called; if an error occurs, the second function with the error is called.</p>
  
  <pre><code>return this.service.createAndGetEntity(result.data.order)
    .map((response: EntityResponse&lt;OrderModel&gt;) =&gt; {
  
      if (result.data.unknownLocation) {
        if (result.data.isRedundant) {
          this.secondService.createWithRedundancy(someData).subscribe(() =&gt; {
            this.dispatchSuccessAction(newOrder);
            return true;
          }, (err) =&gt; {
            this.dispatchErrorAction(err);
            throw Observable.throw(err);
          });
        }
        else {
          this.secondService.createEntity(someData).subscribe(() =&gt; {
            this.dispatchSuccessAction(newOrder);
            return true;
          }, (err) =&gt; {
            this.dispatchErrorAction(err);
            throw Observable.throw(err);
          });
        }
      }
      else {
        this.dispatchSuccessAction(newOrder);
        // also return true here
      }
    });
  </code></pre>
  
  <p>Now to my problem: For the procedure to run correctly, interdependent subscriptions are required, which are executed one after the other based on the result of the previous step. The method should return an Observable at the end, but my snatz does not work. Therefore my question: How do I structure the different calls, so that at the end the correct order is run through and either a true is returned or an error is thrown with corresponding error text?</p>