Accept the fact that everyone occasionally fails, but see it as an opportunity to learn from the experience so you can do better next time. Being positive you can change your houghts into healthy productive ones. It will require effort and and persistence but you're capably of both, right? It's also important to understand that you, and you alone, are in control of the thoughts that pass through your mind.