§ 795. Liability of sheriff for omission of duty. An action may be maintained, in behalf of the people, against a sheriff, to whom a warrant is directed and delivered, as prescribed in this article, to recover damages for any omission of duty with respect to the same, in a case where a judgment creditor might maintain an action against a sheriff, to whom an execution issued out of the supreme court is directed and delivered. In such an action, the people are entitled to recover the same damages, which a judgment creditor would be entitled to recover, if the order imposing the fine was a judgment of the supreme court.