Someone else posted a comment to the tune that failure gives someone an opportunity to decide what they really want. Again, I think it depends. There are people who, despite failure, still want to succeed at the thing they are trying to do. They're just trying to figure out how to do it. I posted a response giving as an example an older-than-average, higher-paid-than-average baseball player who is a career .200 hitter and in danger of being released. Most baseball players want very much to be baseball players; they're not "trying to figure out" what they want to do with their lives. But they all have to take into consideration that they won't be young forever; there will come a day when due to age they can't play as well as the younger players. So they have to ask themselves if they are struggling, if this is really the time to call it quits and move on to the next thing, whether it be in baseball (coaching, scouting), peripheral to baseball, but involved (broadcasting), or something else entirely. Or is there something else they can do (but haven't yet figured out) that can turn their careers around.
I thought of an even better example. There was a pitcher named Mike Scott who started his career with the Mets. He pitched poorly (granted, on poor teams), and wound up being traded to the Astros, where he continued to struggle. In 1985, he was able to turn his career around because Roger Craig, a former pitcher, taught him how to throw a split-fingered fastball. If you look at Scott's stats, you'll see a dramatic improvement from 1985-1989. He was so dominant in 1986, the Mets had to win Game 6 of the NLCS in order not to face him.
As a side note, in defense of currently trying to hang in there and find software work (or at least something related to software work), I hope I can find my Roger Craig that can give or teach me something that can help me be competitive again.