Hey TRP, need some advice

I’m mid twenties, currently in medical school and found out I failed one of my exams. As a result I now have to re-take the year.

This specific year is the hardest in the programme and was made even harder/shittier by the slow breakdown and end of my LTR of 1 year coming up to exams. I had depression and anxiety and i'm not surprised my performance wasn't up to scratch. Even though I gave it my all studying, I felt like there was a mental barrier in the way stopping me giving my best performance.

Now after finding out I have to re-take the year I feel ashamed, like i've let myself down and i'm dreading going back to do this year again.

My question to you guys is: how do you cope/deal with failure? And is there any advice you can give this tired medic who has to do it all again.

Cheers