Clean up some exceptions

The thrown exceptions should have relevant text and actually be thrown
where they are relevant.