I've been there and I get it: failing something is rough. You get upset, you wonder if you should have studied differently, or longer, or if you're just dumb. Here's the thing, buddy, you're not dumb. You're not a failure, and you certainly will not die if you fail a test or two. What is important is that you keep going, keep trying, and keep learning.
I know you are trying to keep your GPA up to go to grad school, medical school, law school, or anywhere else ~successful people~ go. And yeah, if you fail a test in a class that you only have two tests in, your GPA will drop. Your grade in that class will suck. Your transcript will have a blemish on it forever.
But you know what you can do besides mope, cry, and feel bad for yourself? Try again. (After being sad for a quick second.) Go over that test with your professor. Join a study group for the next test. Maybe you had a bad day, or you were sick and you just weren't in the right zone for that test that day. But hey, you're still alive, so keep it kickin'.
I promise you, that one test will not hold you back from whatever goal you have in the future. Our society places so much pressure on grades, and scores, and GPAs. But are you kind? Are you happy? Are you eating healthy and taking care of your body? There are so many more things in life that count more than one test does. Keep those things in mind.
Be thankful that you even had the chance to take and fail that test. There is an abundance of people that wish they could have been in that room, having the opportunity to learn. Be grateful that you FAILED. It's a blessing to fail. What you do with that failure says more about you than what any 'A' could.
I have failed before. I've flunked a mid-term that I thought I aced, and I've done horribly on many, many quizzes. But with every single failure, I try again and I learn more. I study the material again and again and again. I am a better student because of 'bad' grades I've earned, and I wouldn't take those bad grades away.