“How much more harmful are the consequences of anger and grief than the circumstances that aroused them in us!” Marcus Aurelius, Meditations.
‘Losing it’ is usually followed by regret for the things you did when in a moment of madness, be that in a fit of anger, a surge of fear or any other unhelpful and unwanted emotion. While we are not in control of our emotions, we do have control over (and responsibility for) the range of ways in which we can choose to react. Being prepared for emotional moments is key: if you know what makes you angry and can remember how you reacted the last time, what would you do differently next time?
The surest way to limit the potential consequences of an angry outburst is to withdraw from the circumstances that provoked the anger. If you cannot step back physically, then try it psychologically: bite your tongue, count to 10 (or 20, perhaps?), look away, take a deep breath in and let it out slowly. However you plan to react, plan before it happens again, as emotions are more powerful than your ‘logical’ reasoned mind and will carry you away with the moment.