Use exceptions instead of assertions so tests can run without adding -ea