When the setoff of the defendant proved shall exceed the claim of the plaintiff, and such excess in amount exceed the jurisdiction of a justice of the peace, the court shall allow such amount as is necessary to cancel the plaintiff's claim, and give the defendant a judgment for costs; but in such case, the court shall not render judgment for any further sum in favor of the defendant.