Success is not a destination, and neither is failure. We are all on a journey, and we will all encounter successes and failures along the way. The successful understand that failure cannot be avoided. The unsuccessful expect failure and give up when they experience it.
When you experience failure, do not give up. Learn from it. Remember, with failure comes experience. From this experience, you are preparing yourself for greater successes in the future. But whatever you do, do not allow yourself to believe that you are a failure. If you do, you will continue to fail. Because you will eventually stop trying.