In life there are no mistakes, only lessons. When something we think is tragic happens, reflect on what happened, why it happened, and what we can do about it. We can learn a lot from just asking these questions.
Failing your exams does not make you a failure, I would suggest just making a simple plan, figuring out what you are going to do, and then stick with it until you have achieved what you want to achieve.
Hang in there buddy, you'll be fine. Stay positive and everything will be okay.