TL; DR One way to see mindfulness meditation as a high-intensity exercise session of experiencing failure and not "freaking out" about it (e.g. being apprehensive of failing, or criticizing yourself for having failed, or being angry at yourself for not being able to simply achieve something which seems easy on the surface, or being anxious of never being able to do it right, or being frustrated about it not being as easy as you'd like it to be). If you are experiencing frustration, anger and anxiety, it can be two things: you are not yet good enough at it (it's very tough to learn if freaking out is your usual reaction to failure - and it probably is, if you think you need mindfulness meditation), or you are not even aware of the above and therefore not doing it right - that is, you are not doing anything about changing the way you relate to your goals and the way you react to failing to achieve them.
One of the major effects of meditation when used for relieving stress and anxiety is to get you out of a kind of a frustration treadmill. Frustration is the emotion which arises when a person is prevented from achieving a goal he deems important, and can be similar to/occur together with anger and anxiety.
The way mindfulness meditation tries to counteract this is to put you in a frame of mind where you have no expectations. When you are not pursuing a particular goal, you cannot be frustrated by not achieving it, and so frustration does not arise. This reduces negative emotions, and you can start evaluating the thoughts that occur during meditation in a more rational way. Once you learn that, you will have a tool to defuse emotional outbursts which occur in your daily life, outside of meditation, by slipping into that mode.
But there are a few important points which some of the briefer meditation tutorials out there don't explain. First of all, you really have to stop having expectations during the meditation. Not of yourself, not of the meditation, not of anything. In a successful meditation, you observe what is happening, without getting into a "this is what is happening, and it is different from what I want to be happening, dang this isn't working" chain of thoughts.
The second thing the short manuals don't tell you, is that meditation is hard. It is very, very difficult to achieve the ideal situation described in the manuals: perfect focus on one thing (or even nothing) without any distraction. As a beginner, you will not be able to achieve it for more than a few seconds of being in the "right" mode before you slip into the "wrong" mode again. This is completely normal. At one level, meditation appears to be paradoxical: your goal is to have no goals. Don't expect it to happen easily.
A usual session of mindfulness meditation looks like
- You focus on your subject and keep that focus
- Your thought process smoothly transitions to thinking about something else, you are busy thinking these thoughts without realizing that you are not at step 1 anymore
- You notice that you have drifted off.
Your mind reacts to you noticing the drift.
4.a The intended reaction is to acknowledge the distraction, keeping an attitude of mild curiosity and amusement. "I am enumerating the items to get from the supermarket again. But I am meditating now, so let's leave that for later. I could go back to the breathing focus now. In. Pause. Out. Pause. In..."
4.b Any other reaction is not the intended one. For example, "Wait! I should be meditating, not composing a shopping list! That's wrong! It shouldn't have happened! I'm failing at that damn meditating stuff again! Will I never get it right?" But also "OK, I have drifted away. I have to go back to the focusing part. Did I just react right? Oh yeah, I did! I'm getting good at it, baby! I might get the hang of it after all."
If 4.a happens, you are already back at 1. If 4.b happens, you are already back at 2: you are not focused on your subject. So the whole cycle runs again, this time not about the original drifting away, but about your reaction to the drifting away. This time, 4.a looks something like "Oh, it seems I am judging myself. That's not what meditation is about, so let's go back to the breath again. In..."
You will go through the cycle hundreds and thousands times during a single meditation session. And that's OK. While your long-term purpose is to spend more time in 1 and else get to a 4.a as soon as possible, during a meditation, it should not matter to you whether this happened or not. It's like the difference between being the lotto player who is fervently awaiting the drawing of the exact numbers he crossed on the form, reacting with joy or sadness depending on whether the state of the world matched his expectations and wishes, and being the person who pushes the button to get the balls rolling and then records the numbers - part of the process, and focused on it, but not giving a damn about which number comes out.
While I cannot be 100% sure from your short description that this was what happened to you, it fits with a common side effect of not realizing the above. Instead of seeing each drift-off during meditation as a fresh opportunity to exercise being equanimous and unperturbed by whatever they observe happening, beginners frequently experience it as a frustrating failure. And because it happens so quickly in so such a short, intense time period, the frustration mounts, leading to the feelings you described.
If you are serious about doing therapeutic meditation, I would suggest learning more about how it works, how it doesn't work, and to use sources intended for this purpose, not sources intended for religious meditation. The one which helped me most was "The mindful way through depression" by Mark Williams. While it is obviously geared towards depression, you don't have to have a depression diagnosis to benefit from it. Its focus is on good techniques of mindful meditation. You can simply read on these techniques while leaving out the depression specific material.
You can also try to learn more about human emotional reactions, which is very helpful for understanding yourself while meditating and reducing unrealisitc expectations you might have about your control over your own thought process (which result in frustration during meditation). A very accessible source is Paul Ekman's "Emotions revealed". Note that his categorizing of emotions is only one of many suggested in research, so don't take that part as gospel, although it's fun to read. But his explanation of how an emotion plays out in the mind is valuable, and the detailed descriptions of several emotions can help you deal better with them when they arise in you.