When Judah heard that Tamar had been "sleeping around", he made a public call for her execution. Contrast this to her discrete defense. She sent a message to him asking "Whose ring and staff and cord are these?" in Genesis 38:25. She tacitly pointed out that if she was guilty, so was he, but she did so in a way that gave him the option of admitting his guilt or denying it. Hence his statement in the v26:
*Then Judah identified them and said, “She is more righteous than I, since I did not give her to my son Shelah.” And he did not know her again.*
Consider also how different Judah's public shaming of Tamar was from Joseph's decision to quietly put Mary away when he discovered that she was pregnant with someone else's child.