We can't control the outcome of our hard work. But you can better prepare yourself for the possibility that things might not go your way. And that's okay because maybe that wasn't “your way" in the first place.
Just because the failure occurred in your life instead of someone else's life, it does not mean that it defines you and your life at the moment or frankly at all. There is always a reason for things happening in your life even though you may not quite understand it. So just keep in mind that your failures may seem crappy at the time, but they are there to teach you that you are stronger than you already know. So not only do your failures provide you lessons to learn from, but they also allow you to see where your path is headed. So it’s okay to take your time to relax while you are in the midst of a failure. Try reading an inspirational book, quote, or listening to a podcast, Find your zen and make some time to just take care of you when you are going through your failures.