Upon appeal in a civil action the appeals court and supreme judicial court shall have all the powers of amendment of the court below; and whenever objections have been taken to the exclusion of evidence, or where the alleged error arises from the omission at the trial of some fact which, under the circumstances of the case, may subsequently be proved without involving any question for a jury, and without substantial injustice to either party the appellate courts shall have full discretionary authority to cause such further testimony to be taken as it deems necessary, either by oral examination in court, by reference, by affidavit or by deposition, and both courts shall have power to render any judgment and to make any order that ought to have been made upon the whole case.
Mass. Gen. Laws ch. 231, § 125