title: Why a rejected parameter of a promise works outside of its scope?
body: <p>See, a promise have two parameters <strong>resolved</strong> and <strong>rejected</strong>. So by calling <strong>then</strong>, you are passing it 2 parameters. </p>
  
  <pre><code>router.route('/issue/add').post((req,res) =&gt; 
  {
      let issue= new Issue(req.body);
  
      issue.save().then((issue) =&gt; 
          {
              res.status(200).json({'issue': 'Added Successfully'});
          }).catch(err =&gt; 
          {
              res.status(400).send('Failed to create a requested record');
          });
  });
  </code></pre>
  
  <p>but in the code above <strong>issue</strong> is passed and mapped to <strong>resolved</strong> but for <strong>rejected</strong> an <strong>err</strong> param need to be passed in <strong>then</strong> but instead it is passed in <strong>catch</strong> and works. Why?</p>