"The greatest glory in living lies not in never falling, but in rising every time we fall." -Nelson Mandela
If you look at the lives of the most successful people, you'll find they often find failure a lot more than they find success.
Steve Jobs, famous as the cofounder of Apple computer, was fired from his company 9 years after he had founded it because of a number of issues people in the company had with him. He quickly created another company called NeXT computer, which was an even bigger failure (as evidenced by the fact that no one has heard of it). It wasn't until later on that he began to find more success - he helped start up Pixar, and Apple is only the big deal it is now because of the way he brought the things he learned back into the company.
Elon Musk, another entrepreneur, is still leading people into crazy ideas today, such as reusable, self-landing rockets and electric vehicles. But before his rockets were landing themselves, they were exploding on the launch site. There were several failed launch attempts before they got a single rocket up into space.
The point is, just because you fail doesn't mean you have to be a failure. The successful people aren't the ones who get it right all the time, but the ones who don't quit when they get it wrong.
Don't let your failures tell you who you are. For that matter, don't let your successes tell you who you are, either! Both of these mindsets will lead you into places of despair.
Get your identity from something that doesn't depend on your performance. You won't get things right every time, but when you get it wrong, you'll be able to get back up again.