This seems to be the sort of thing ValueError is intended for.  Something is NULL that shouldn't be or a numeric value is out of range, etc.