You can't control everything that life will throw at you. Sometimes things unexpected will happen. But you have to be prepared for whatever. And don't let yourself get off track.
There are times when you will get disappointed or feel frustrated or feel like you failed. But that is all a part of life. The most important thing you can do when that happens is get up, dust yourself off, and get back on track.
That is truly the key. You can get sidetracked, but as soon as you notice it, get back on track and do it fast. That way you will never be diverted for too long, and you will hold on to your goals.