Mistakes always have the potential for learning. If you find yourself constantly failing to achieve your current task, it's time to change gears. Good ways are either put the project down and take a break or switching to something else.
A lot of the time I do this, I have a fresh perspective again and continue working, whether I need to change strategies or I found I had a misplaced semicolon.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.