I would not worry too much I was an instructor and saw some competent guys fail. I also think many of us have failed at least one exam, I failed my multi. One friend failed his PPL/CPL/IR first time and he is now RH seat BA. Don't let it get you down or you will probably worry yourself into failing again.
About the commercial go and have a chat with your CFI/senior instructor and get an honest opinion from him about your flying ability. Decide from that as it is very difficult to judge your own ability particually when you low experience.
Best of luck with re-test.