Your confidence and ego should be fine and intact - believe it or not.
Your trust and belief in your WW? Shattered and non-existent - obviously.
Have you betrayed her? no. You have been honest and true. Your integrity is intact. Hers is gone forever. She will never get it back.
Infidelity is NOT a marital problem. It is a personal problem. It has nothing to do with you or your marriage. Although many waywards will perceive trivial issues in the marriage as a great excuse or justification for acting on self-worth issues that existed in them long before you met.
It has nothing to do with you and your abilities.