Sometimes, all of the planning in the world won't stop a problem from occurring. Recently a piece of code deployed to production. It took a perfectly functional process and rendered it inert, no longer saving data that used to save. It wasn't horrible, being caught fairly early, but people got upset.
This is understandable. Here are the facts: Code was deployed. Code wasn't right. Data was lost.
Sometimes it's hard to hear that, but it's true. Your process is continually evolving, as a developer or as a team, and sometimes process is just broken and you don't know it. The code in question here was in testing for five full months, but no one noticed the issue. Would TDD have helped see the issue early? Probably. Would better QA and end user testing have helped? Absolutely. But...
The key thing isn't that something happened, but in how you deal with it. Fact: This happened already, and you can't turn back time. What do you do? Fix the problem.
Some people want to start pointing fingers, looking up who did what, and assigning blame. And, while holding people accountable for their actions is important, the really important thing, at this moment, is to get right. Fix the problem. Step away from the negative, focus on the issue at hand, and gain some resolution, even if it is in small incremental steps. You can do an After Action Review of what happened later, and use the failure as an opportunity to learn, grow, and mentor. Chances are that you've identified a hole in your process that needs correction. But all of that is secondary to correcting your immediate issue, getting things right again for your client.
It isn't the mistakes you make in life that define you, but in how you handle them.
"I'm afraid that we all make mistakes. One of the things that defines our character is how we handle mistakes. If we lie about having made a mistake, then it can't be corrected and it festers. On the other hand, if we give up just because we made a mistake, even a big mistake, none of us would get far in life." - Terry Goodkind