If a loss or injury to a party in an action or proceeding has been caused by the contempt, the court, in addition to the punishment imposed for the contempt, may give judgment in favor of the party aggrieved and against the person guilty of contempt for a sum of money sufficient to indemnify that party and to satisfy the costs and disbursements of that party. The judgment and the acceptance of that amount is a bar to an action or proceeding by the aggrieved party for the loss or injury.