| 134 | class Index { |
| 135 | public: |
| 136 | Index(std::string name, const std::string& parameters) { |
| 137 | if (auto index = vsag::Factory::CreateIndex(name, parameters)) { |
| 138 | index_ = index.value(); |
| 139 | } else { |
| 140 | vsag::Error error_code = index.error(); |
| 141 | if (error_code.type == vsag::ErrorType::UNSUPPORTED_INDEX) { |
| 142 | throw std::runtime_error("error type: UNSUPPORTED_INDEX"); |
| 143 | } else if (error_code.type == vsag::ErrorType::INVALID_ARGUMENT) { |
| 144 | throw std::runtime_error("error type: invalid_parameter"); |
| 145 | } else { |
| 146 | throw std::runtime_error("error type: unexpectedError"); |
| 147 | } |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | public: |
| 152 | void |