There are many things in life that you cannot control, trust me there are things you should just let be but you can always control your attitude toward them.
Defeat and the feeling that comes with it is never permanent unless you allow it to be so. When you have a positive attitude, you will recognize failure for the impostor that it is and realize that it is really a learning experience, a valuable lesson that will help you succeed with the next attempt.
The important thing is to ask what could I have done differently that could have altered the outcome? What can I do in the future to minimize problems and mistakes? What did I learn from this experience that can put to good use next time?
If you approach obstacles and setbacks with a positive attitude, you will be surprised how quickly you can turn defeat into victory.