See full errors in JavaScript when catching Promises

This is probably something you know already but I'm just jotting it down because I found it useful when debugging promises.

myPromise()  
.catch(err => {
  console.log(err && err.stack || err);
});

The exp && exp.prop || exp part is actually really handy as well because you typically will do a guard on a property but then you may want to still get the original value regardless.

So if...

var err = 'oops!';  
var errorMessage = err && err.stack || err;  
console.log(errorMessage);  

You'll get 'oops!' instead of undefined.

Any hoo.