code: function getFullErrorStack(ex) {
    var ret = ex.stack;
    if(ex.cause && typeof(ex.cause) === 'function') {
      var cex = ex.cause();
      if(cex) {
        ret += '\nCaused by: ' + getFullErrorStack(cex);
      }
    }
    return ret;
  }
docs: Dumps long stack traces for exceptions having a cause() method.
  
  @param ex The exception.
  
  @return A string representation of the error stack.