§ 778. Prosecution of undertaking by person aggrieved. The order directing the undertaking to be prosecuted, may, in the discretion of the court, direct the prosecution thereof, by and in the name of any party aggrieved by the misconduct of the accused. In such a case, the plaintiff may recover damages, to the extent of the loss or injury sustained by him, by reason of the misconduct, together with the costs and expenses of prosecuting the special proceeding in which the warrant was issued; not exceeding the sum specified in the undertaking.