I answered this question today over at Dear Design Student, an advice publication for designers, answered by designers. Or, in this case, a developer.
“I really messed up on a client project. What do I do about it?
The short answer? Own it. Fix it (if you can). And learn from it.