What I've learned is I can't control my feelings when my brain decides to be like that, but what I can control are my reactions to those feelings. It takes a bit to figure out but I know that that snide comment was said by an asshole and it makes ya feel those feelings, but remember that you've now experienced the task you are doing and what went wrong and you learn from that. Learn from that so next time you can be prepared for the situation. Eventually I forget what the snide comment was (or I stop caring because I'm focused on my job rather than on the comment).
Idk if I explained it well, but subvert your attention to something else if you can and those feelings will stop bothering you as much. Also if it helps, I tend to make up a ton of juicy comebacks I could've said to the snide comment and that makes things better sometimes.
In any case, this is gonna happen again, it's what you do with the situation that counts. What's cool is you recognize those feelings and are trying to figure it out. That's the first step in learning how to control your reactions to those emotions. You are a strong, good person and are doing what you can to live in this fucked up society. It was good of you to comment here if that's what helps you :) you ain't alone in this! Ttyl
Edit: I can't spell, fixed some words