Let’s say that you are in a polyline command and you just pressed on a wrong point. Don’t panic. There’s an easy solution that it doesn’t require to stop the polyline command and lets you undo.
After the error just press U (Undo) and ENTER and the last corner of the polyline will disappear. The steps that your polyline will brought back are as many as the times you will use undo.