function extendStack (targetError, sourceError) {
if (hasLazyStack(targetError)) {
  if (sourceError) {
    lazyJoinStacks(targetError, sourceError);
  }
  else {
    lazyPopStack(targetError);
  }
}
else {
  if (sourceError) {
    targetError.stack = joinStacks(targetError.stack, sourceError.stack);
  }
  else {
    targetError.stack = popStack(targetError.stack);
  }
}
}
Extend the error stack to include its cause

@param {Error} targetError
@param {Error} sourceError