from the
current promise, you have to &quot;rethrow&quot; the error by returning a rejection constructed via
<code>reject</code>.</p>
<pre><code class="lang-js">promiseB = promiseA.then(function(result) {
  // success: do something and resolve promiseB
  //          with the old or a new result
  return result;
}, function(reason) {
  // error: handle the error if possible and
  //        resolve promiseB with newPromiseOrValue,
  //        otherwise forward the rejection to promiseB
  if (canHandle(reason)