Reflect
Failing and making mistakes is not enough in order to learn and become better. You also need to dedicate time on reflecting on what has happened and why it didn't work.
Here's where a problem lies. When most people reflect on bad experiences, their feelings resurface. There's anger, anxiety, stress, fear, tears and emptiness. In order for the reflection to work and make you better you need to turn these feelings around.
Examine the past experiences without passing judgement and feeling bad. Things happen for a reason and by reflecting positively on the past you learn and expand your brain capacity. You can even create new pathways in your brain and start feeling better. Think of what could have gone worse or how your failure protected you from things getting worse.
As always, for this to work you need to turn it into a practice. Try to at least dedicate an hour once a week reflecting on past experiences. Turning the bad ones into good ones and learning from them. You will then gradually start feeling better and facing problems with a more positive attitude.