throw exceptions for bad input