title: How do I handle errors with promises?
body: <p>As a node programmer. I'm used to use "nodebacks" for handling errors in my code:</p>
  
  <pre><code>myFn(param, function(err, data) {
      if (err){
          //error handling logic
       }
       else {
          // business logic
      }
  });
  </code></pre>
  
  <p>When writing that function, I can do something like:</p>
  
  <pre><code>var myFn = function(param, callback){
      var calc = doSomeCalculation(param);
      if(calc === null) { // or some other way to detect error
          callback(new Error("error with calculation"), null);
      }
      ...
      someAsyncOp(calcN,function(err, finalResult){
          if(err) return callback(err, null);
          callback(null, finalResult); // the error is null to signal no error
      });
  
  };
  </code></pre>
  
  <p>How would I do this sort of error handling with promises?</p>