You want to push your muscles hard, but you don't always have to literally go to failure. In the example you gave, you should have stopped before the final rep where your muscle gave out. When in doubt if you can complete another rep, don't try, or wait 30 seconds or so and then try to push it...