Remember its not you, its them. Yes, sometimes you've messed up and should be admonished. But a lot of times, people are having a bad day or are rude to everyone. Their behavior ultimately doesn't reflect your worth as a person. I remember as a 3rd year I got yelled at for the umpteenth time by the attending for breaking scrub. I laughed and went to re-scrub. I cut myself some slack but made sure that I was more conscientious of my movements. I was new! What the hell did I know? And my actions could have led to the patient getting and infection! So he had the right to be annoyed. But at the same time, he was so high strung that I just found him to be a funny person in general. I'm sure another med student would have wilted. That attending ended up being a great mentor to me.
Really, try your best, think about the content of what people say and not how they say it (surgeons dont have the best social skills anyway), use it to improve, and cut yourself some slack. Absolutely no one is perfect. Some attendings still ride the backs of their finest residents. There is something funny about surgical culture - A. you have to prove yourself to surgeons for some of them to even acknowledge your existence (e.g. work hard, show initiative and improvement) and B. some surgeons think its weakens a trainee by complimenting them too much!
I used any negative energy thrown at me to just keep getting better and showed up every day with a smile on my face. By the end of my rotations my attendings were ridiculously happy to write letters of recommendation for me after I decided that I STILL wanted to go into surgery. And they ended up being really nice people outside of work!
But that's how I am in life in general, and it took me a long time to gain that perspective. Most people don't know you well enough to make any accurate value judgments about you. So if they're rude or mean, it has less to do with you and more to do with them and their issues. Keep applying that principle to your everyday life and your skin grows thick without you having to change who you are.