Throws error if object parameter is not valid in the API response