I completely understand because a similar thing happened to me. I took a re-exam on a subject and I knew that I did not perform well and the marks from that exam was to be included in overall evaluation.
However, it is important to note that one exam is not going to determine your life. It might seem like that right now, but it's not the end of the world.
With that said, it is completely okay if you are feeling anxious, sad or frustrated and it is difficult to go through it.
I came across this method of coping. Try it and see if it helps.
It is to think about the worst case scenario and see if it really will have such a big impact on your life. Ask yourself the question, "What's the worst that will happen?" and then ask yourself, "Is it really going to be the end of the world?", "Is it really as bad as I think it is?"
Assess if the the problem is worth the anxiety, know that it's okay even if you fail and that you are not alone.