title: How do I catch inner exception?
body: <p>I want to be able to catch an exception being thrown inside a promise, from outside the function of that promise. See the following code:</p>
  
  <pre><code>throwError = () =&gt; {
      throw new Error("myError");
  };
  
  
  let iWantToCatchTheErrorThatThisOneThrows = () =&gt; {
      return (new Promise( (resolve) =&gt; {
          resolve()
  
      }).then(() =&gt; {
          (new Promise( (resolve, reject) =&gt; {
              return throwError();
          }));
          return new Promise((resolve) =&gt; setTimeout(resolve, 1000));
      })).catch((error) =&gt; {
          //Never reaches here
          console.log(error)
      });
  };
  
  iWantToCatchTheErrorThatThisOneThrows().then(() =&gt; {
      console.log("Quit gracefully");
  }).catch((error) =&gt; {
      //Never reaches here
      console.log(error);
  });
  </code></pre>
  
  <p>I can catch the inner error, but I can't throw it to end up where I want to (in the end), by adding a catch in the middle:</p>
  
  <pre><code>let iWantToCatchTheErrorThatThisOneThrows = () =&gt; {
      return (new Promise( (resolve) =&gt; {
          resolve()
  
      }).then(() =&gt; {
          (new Promise( (resolve, reject) =&gt; {
              return throwError();
          })).catch((error) =&gt; {
              //Prints, but thrown error isn't bubbled anywhere
              console.log(error);
              throw new Error(error);
          });
          return new Promise((resolve) =&gt; setTimeout(resolve, 1000));
      })).catch((error) =&gt; {
          //Never reaches here
          console.log(error)
      });
  };
  
  iWantToCatchTheErrorThatThisOneThrows().then(() =&gt; {
      console.log("Quit gracefully");
  }).catch((error) =&gt; {
      //Never reaches here
      console.log(error);
  });
  </code></pre>
  
  <p>All tests are run in Nodejs 7.1.0</p>