throw exceptions when appropriate