throws proper exceptions