Failing is Bittersweet
God's always sending tests our way, and if it means anything, it's that God loves you and wants to teach you something new. He will still love you whether you fail or succeed in that test. And it's not actually about failing or succeeding, but rather the lesson that you'll learn from every experience if you look between the lines. If you fail, it won't be the end of the world, it might be that God is reminding you that things don't have to go always your way and if they don't then it doesn't mean he loves you less, or he won't give you what you think you need. It only means he's teaching you many things.
You might have failed so he can teach you than you're not always right, that you don't always know best. You might have failed so he can remind you how good success tastes, because if you never fail, you'll never know how good it feels to succeed. You might have failed so he can remind you that you should never give up, that failing is not the end of the world, that right after you fail is the time you get up and work hard on thinking everything again and make a change of plans. You might have failed because it wouldn't have been that good, or of any good, if you'd succeeded on that thing, because he knows better. You might have failed, because he has something in store for you that is way better. You might have failed so he can teach you to have patience. You might have failed so he you can work harder next time on this same thing, because whenever you work harder, success will taste even better. Easy come easy go!
Failure is the worst feeling there is, it burns the heart and the mind. You feel your weakest right after failing. Right after you fail is the time when it's most important to see the full half of the cup. Learn your lesson and get up, be strong. Do all your grieving, yet don't over do it. Accept the facts and work from there, rethink your life, your reasons, your plans. Right after a failure is the time when faith works best, that's the time when you should remember that you've failed for a reason, one that you might not see right now, but will someday see and understand. When you fail, don't just stop there, don't let it kill you, move on. Fall seven times, stand up eight.