title: Catching an error thrown inside setinterval function in Bluebird
body: <pre><code>this.custFunc = Bluebird.method(function (id)) {
  
      var interval = setInterval(function () {
                  calc(id)
                  .then(function (flag) {
                      if (flag) {
                          execProg(id, interval);
                      }
                  })
                  .catch(function (err) {
                      return Bluebird.reject(err);
                  });
              }, pollingInterval);
  });
  </code></pre>
  
  <p>How do I catch the error being thrown inside the setinterval function? I am not able to figure it out?</p>