511. (1) Subject to the provisions hereinbefore contained, no finding, sentence or order passed by a Court of competent jurisdiction shall be reversed or altered by a Court of appeal, confirmation of revision on account of any error, omission or irregularity in the complaint, summons, warrant, proclamation, order, judgment or other proceedings before or during trial or in any inquiry or other proceedings under this Sanhita, or any error, or irregularity in any sanction for the prosecution, unless in the opinion of that Court, a failure of justice has in fact been occasioned thereby.
(2) In determining whether any error, omission or irregularity in any
proceeding under this Sanhita, or any error, or irregularity in any sanction
for the prosecution has occasioned a failure of justice, the Court shall
have regard to the fact whether the objection could and should have been
raised at an earlier stage in the proceedings.