Move exceptional cases into exceptions