title: How to handle errors from multiple then in catch of javascript promises?
body: <p>let p be a promise we can do</p>
  
  <pre><code>p
  .then(f1)
  .then(f2)
  .then(f3)
  .catch(f4)
  </code></pre>
  
  <p>now in catch, error can be thrown from any of f1,f2,f3 or even p rejected </p>
  
  <p>now what should be the proper way to handle errors in f4(or in catch) , as errors thrown above can be of different types, Can multiple if else be avoided in f4
  ?</p>