Avoid overlapping error overlays

This addresses one of the issues raised in #380, by

- ensuring that no overlay is added to a line that already contains an error
  overlay
- removing all overlays before adding one for an error.