Recently I added translation of the std::invalid_argument exception to ValueError, I think that would be a better exception to use here and below.