Romans 8:28 says everything works for good.
If you were in a marriage relationship, where you did everything you possibly could for your spouse, where you sacrificed a lot for them, then they cheated on you with the possibility of leaving you with some STIs, How is that good?
How does it work for good? Even if you get a divorce, you are left with deep wounds and definitely do not want to be in another relationship or at least don't want to commit to someone, How is that working for good?
"And we know that God causes all things to work together for good to those who love God, to those who are called according to His purpose" (Romans 8:28).
Paul states that God is able to take everything that happens in this world -- both the good and the bad -- and cause them to result in the betterment of His people (Psalms 128:1-2; Isaiah 3:10). Later Paul clarifies that it isn’t just good things happen to God’s people (Romans 8:35-36). Bad things do happen, and God is able to make those work out for the good of His people. Affliction can keep people on the right track (Psalms 119:67, 71; Jeremiah 31:18-19; Hebrews 12:11).
This benefit doesn’t come to everyone. It is for those who love God (I Corinthians 2:9; James 1:12). It is for those who are called according to God’s purpose (II Timothy 1:9; Ephesians 1:11-14). God’s purpose then is the standard by which we are called (Ephesians 3:8-12).
You're wife, contrary to the teachings of God, chose to commit adultery. The blame for the sin rests solely on her choice. What she did was not do to God.
Can good come from this? I have seen people turn from their sins and, as a result, they become stronger Christians. I've seen Christians become stronger when they manage to forgive their wayward spouses, even if their spouses don't return to the Lord. Trials tend to highlight weaknesses in our character, showing us where we need to change to become better people (Hebrews 12:5-14). The hardship is never fun, but we have to focus on the end result. "All discipline for the moment seems not to be joyful, but sorrowful; yet to those who have been trained by it, afterwards it yields the peaceful fruit of righteousness" (Hebrews 12:11).
But if the hardship turns you away from God, then you won't gain the benefits. That was what Satan hoped would happen to Job. "Then Satan answered the LORD, 'Does Job fear God for nothing? Have You not made a hedge about him and his house and all that he has, on every side? You have blessed the work of his hands, and his possessions have increased in the land. But put forth Your hand now and touch all that he has; he will surely curse You to Your face'" (Job 1:9-11). In Job's case, it didn't work.
Thus, is this going to be something you grow from or are you going to allow Satan to turn you into a bitter man?