Simplify loop

Since this method is the only updater of the `lastErr` field, it doesn't
need lock protection to read it.