title: how to properly throw an error if promise is rejected? (UnhandledPromiseRejectionWarning)
body: <p>I have a promise and I would like an exception to be thrown if the promise is rejected. I tried this:</p>
  
  <pre><code>var p = new Promise( (resolve, reject) =&gt; {
    reject ("Error!");
  } );
  
  p.then(value =&gt; {console.log(value);});
  </code></pre>
  
  <p>but I get a DeprecationWarning:</p>
  
  <pre><code>(node:44056) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error!
  (node:44056) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  </code></pre>
  
  <p>What is the correct way to throw an error (so that the program is terminated with a stack trace) if the promise is rejected?</p>
  
  <p>I already tried to insert a throw statement in a catch clause, but this again produces a DeprecationWarning as before. In fact (after some reading) I understand that a throw in a catch produce another call to the reject callback.</p>