At some point you’re going to fail. It’s inevitable, especially if you’re a writer. It’s what you do with failure that really counts. If you accept that’s an opportunity, (or ‘crisortunity’ as I’ve learned from Homer Simpson), then you can use it as a platform to succeed upon while learning something about yourself in the process.
I recommend that everyone watch JK Rowling’s Harvard commencement speech on the importance of failure. It’s a lesson we all need a reminder of every once in a while.