I've failed many times in my life. It's not how many times you get knocked down but all the times you get back up makes you a stronger person. Failures aren't defeat but things that didn't go the way you wanted. Failure is an event not a person.
I've been there. You have to pick yourself up and preserve through it. It may seem hard but reach deep inside of you and believe in yourself that you can get through anything. Failures only define us if we choose to let them. I promise you will look back and be proud of yourself for not quiting and giving up. Think positive and it will change how you view things.
Keep positive quotes or sayings around where you can see them and when a negative thought comes go to those thoughts. I know it sounds stupid but when I'm down and I look at positive things it reminds me where my thoughts should be and I read it to myself. What we put in our minds is what comes out in our thinking and attitude.