I feel so mad at myself right now

Today I've felt on edge all day, and I don't know why. But my son who is 3 refused a nap today so he was tired and grouchy also. I feel like a terrible mother because I snapped and yelled at him when he wasn't listening and he is an emotional child so he broke down sobbing. I immediately started crying too and held him and said I was sorry and that I love him and he gave me kisses and hugs. But I hate that I snapped at him over something so stupid!! I feel like I failed him as a mother tonight. I've never done that before and this hurts, I am so upset with myself right now. I'm normally so calm and have so much patience but today was a struggle and I just hate that I yelled at him.