mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-22 20:50:04 +01:00
fix all the error codes
This commit is contained in:
parent
ba150f2127
commit
3872a1b8d1
@ -294,41 +294,41 @@ impl From<v2::updates::UpdateResult> for v3::updates::UpdateResult {
|
||||
impl From<String> for v3::Code {
|
||||
fn from(code: String) -> Self {
|
||||
match code.as_ref() {
|
||||
"CreateIndex" => v3::Code::CreateIndex,
|
||||
"IndexAlreadyExists" => v3::Code::IndexAlreadyExists,
|
||||
"IndexNotFound" => v3::Code::IndexNotFound,
|
||||
"InvalidIndexUid" => v3::Code::InvalidIndexUid,
|
||||
"InvalidState" => v3::Code::InvalidState,
|
||||
"MissingPrimaryKey" => v3::Code::MissingPrimaryKey,
|
||||
"PrimaryKeyAlreadyPresent" => v3::Code::PrimaryKeyAlreadyPresent,
|
||||
"MaxFieldsLimitExceeded" => v3::Code::MaxFieldsLimitExceeded,
|
||||
"MissingDocumentId" => v3::Code::MissingDocumentId,
|
||||
"InvalidDocumentId" => v3::Code::InvalidDocumentId,
|
||||
"Filter" => v3::Code::Filter,
|
||||
"Sort" => v3::Code::Sort,
|
||||
"BadParameter" => v3::Code::BadParameter,
|
||||
"BadRequest" => v3::Code::BadRequest,
|
||||
"DatabaseSizeLimitReached" => v3::Code::DatabaseSizeLimitReached,
|
||||
"DocumentNotFound" => v3::Code::DocumentNotFound,
|
||||
"Internal" => v3::Code::Internal,
|
||||
"InvalidGeoField" => v3::Code::InvalidGeoField,
|
||||
"InvalidRankingRule" => v3::Code::InvalidRankingRule,
|
||||
"InvalidStore" => v3::Code::InvalidStore,
|
||||
"InvalidToken" => v3::Code::InvalidToken,
|
||||
"MissingAuthorizationHeader" => v3::Code::MissingAuthorizationHeader,
|
||||
"NoSpaceLeftOnDevice" => v3::Code::NoSpaceLeftOnDevice,
|
||||
"DumpNotFound" => v3::Code::DumpNotFound,
|
||||
"TaskNotFound" => v3::Code::TaskNotFound,
|
||||
"PayloadTooLarge" => v3::Code::PayloadTooLarge,
|
||||
"RetrieveDocument" => v3::Code::RetrieveDocument,
|
||||
"SearchDocuments" => v3::Code::SearchDocuments,
|
||||
"UnsupportedMediaType" => v3::Code::UnsupportedMediaType,
|
||||
"DumpAlreadyInProgress" => v3::Code::DumpAlreadyInProgress,
|
||||
"DumpProcessFailed" => v3::Code::DumpProcessFailed,
|
||||
"InvalidContentType" => v3::Code::InvalidContentType,
|
||||
"MissingContentType" => v3::Code::MissingContentType,
|
||||
"MalformedPayload" => v3::Code::MalformedPayload,
|
||||
"MissingPayload" => v3::Code::MissingPayload,
|
||||
"create_index" => v3::Code::CreateIndex,
|
||||
"index_already_exists" => v3::Code::IndexAlreadyExists,
|
||||
"index_not_found" => v3::Code::IndexNotFound,
|
||||
"invalid_index_uid" => v3::Code::InvalidIndexUid,
|
||||
"invalid_state" => v3::Code::InvalidState,
|
||||
"missing_primary_key" => v3::Code::MissingPrimaryKey,
|
||||
"primary_key_already_present" => v3::Code::PrimaryKeyAlreadyPresent,
|
||||
"max_fields_limit_exceeded" => v3::Code::MaxFieldsLimitExceeded,
|
||||
"missing_document_id" => v3::Code::MissingDocumentId,
|
||||
"invalid_document_id" => v3::Code::InvalidDocumentId,
|
||||
"filter" => v3::Code::Filter,
|
||||
"sort" => v3::Code::Sort,
|
||||
"bad_parameter" => v3::Code::BadParameter,
|
||||
"bad_request" => v3::Code::BadRequest,
|
||||
"database_size_limit_reached" => v3::Code::DatabaseSizeLimitReached,
|
||||
"document_not_found" => v3::Code::DocumentNotFound,
|
||||
"internal" => v3::Code::Internal,
|
||||
"invalid_geo_field" => v3::Code::InvalidGeoField,
|
||||
"invalid_ranking_rule" => v3::Code::InvalidRankingRule,
|
||||
"invalid_store" => v3::Code::InvalidStore,
|
||||
"invalid_token" => v3::Code::InvalidToken,
|
||||
"missing_authorization_header" => v3::Code::MissingAuthorizationHeader,
|
||||
"no_space_left_on_device" => v3::Code::NoSpaceLeftOnDevice,
|
||||
"dump_not_found" => v3::Code::DumpNotFound,
|
||||
"task_not_found" => v3::Code::TaskNotFound,
|
||||
"payload_too_large" => v3::Code::PayloadTooLarge,
|
||||
"retrieve_document" => v3::Code::RetrieveDocument,
|
||||
"search_documents" => v3::Code::SearchDocuments,
|
||||
"unsupported_media_type" => v3::Code::UnsupportedMediaType,
|
||||
"dump_already_in_progress" => v3::Code::DumpAlreadyInProgress,
|
||||
"dump_process_failed" => v3::Code::DumpProcessFailed,
|
||||
"invalid_content_type" => v3::Code::InvalidContentType,
|
||||
"missing_content_type" => v3::Code::MissingContentType,
|
||||
"malformed_payload" => v3::Code::MalformedPayload,
|
||||
"missing_payload" => v3::Code::MissingPayload,
|
||||
other => {
|
||||
log::warn!("Unknown error code {}", other);
|
||||
v3::Code::UnretrievableErrorCode
|
||||
|
@ -274,48 +274,48 @@ impl<T> From<v4::Setting<T>> for v5::Setting<T> {
|
||||
impl From<v4::ResponseError> for v5::ResponseError {
|
||||
fn from(error: v4::ResponseError) -> Self {
|
||||
let code = match error.error_code.as_ref() {
|
||||
"CreateIndex" => v5::Code::CreateIndex,
|
||||
"IndexAlreadyExists" => v5::Code::IndexAlreadyExists,
|
||||
"IndexNotFound" => v5::Code::IndexNotFound,
|
||||
"InvalidIndexUid" => v5::Code::InvalidIndexUid,
|
||||
"InvalidMinWordLengthForTypo" => v5::Code::InvalidMinWordLengthForTypo,
|
||||
"InvalidState" => v5::Code::InvalidState,
|
||||
"MissingPrimaryKey" => v5::Code::MissingPrimaryKey,
|
||||
"PrimaryKeyAlreadyPresent" => v5::Code::PrimaryKeyAlreadyPresent,
|
||||
"MaxFieldsLimitExceeded" => v5::Code::MaxFieldsLimitExceeded,
|
||||
"MissingDocumentId" => v5::Code::MissingDocumentId,
|
||||
"InvalidDocumentId" => v5::Code::InvalidDocumentId,
|
||||
"Filter" => v5::Code::Filter,
|
||||
"Sort" => v5::Code::Sort,
|
||||
"BadParameter" => v5::Code::BadParameter,
|
||||
"BadRequest" => v5::Code::BadRequest,
|
||||
"DatabaseSizeLimitReached" => v5::Code::DatabaseSizeLimitReached,
|
||||
"DocumentNotFound" => v5::Code::DocumentNotFound,
|
||||
"Internal" => v5::Code::Internal,
|
||||
"InvalidGeoField" => v5::Code::InvalidGeoField,
|
||||
"InvalidRankingRule" => v5::Code::InvalidRankingRule,
|
||||
"InvalidStore" => v5::Code::InvalidStore,
|
||||
"InvalidToken" => v5::Code::InvalidToken,
|
||||
"MissingAuthorizationHeader" => v5::Code::MissingAuthorizationHeader,
|
||||
"NoSpaceLeftOnDevice" => v5::Code::NoSpaceLeftOnDevice,
|
||||
"DumpNotFound" => v5::Code::DumpNotFound,
|
||||
"TaskNotFound" => v5::Code::TaskNotFound,
|
||||
"PayloadTooLarge" => v5::Code::PayloadTooLarge,
|
||||
"RetrieveDocument" => v5::Code::RetrieveDocument,
|
||||
"SearchDocuments" => v5::Code::SearchDocuments,
|
||||
"UnsupportedMediaType" => v5::Code::UnsupportedMediaType,
|
||||
"DumpAlreadyInProgress" => v5::Code::DumpAlreadyInProgress,
|
||||
"DumpProcessFailed" => v5::Code::DumpProcessFailed,
|
||||
"InvalidContentType" => v5::Code::InvalidContentType,
|
||||
"MissingContentType" => v5::Code::MissingContentType,
|
||||
"MalformedPayload" => v5::Code::MalformedPayload,
|
||||
"MissingPayload" => v5::Code::MissingPayload,
|
||||
"ApiKeyNotFound" => v5::Code::ApiKeyNotFound,
|
||||
"MissingParameter" => v5::Code::MissingParameter,
|
||||
"InvalidApiKeyActions" => v5::Code::InvalidApiKeyActions,
|
||||
"InvalidApiKeyIndexes" => v5::Code::InvalidApiKeyIndexes,
|
||||
"InvalidApiKeyExpiresAt" => v5::Code::InvalidApiKeyExpiresAt,
|
||||
"InvalidApiKeyDescription" => v5::Code::InvalidApiKeyDescription,
|
||||
"index_creation_failed" => v5::Code::CreateIndex,
|
||||
"index_already_exists" => v5::Code::IndexAlreadyExists,
|
||||
"index_not_found" => v5::Code::IndexNotFound,
|
||||
"invalid_index_uid" => v5::Code::InvalidIndexUid,
|
||||
"invalid_min_word_length_for_typo" => v5::Code::InvalidMinWordLengthForTypo,
|
||||
"invalid_state" => v5::Code::InvalidState,
|
||||
"primary_key_inference_failed" => v5::Code::MissingPrimaryKey,
|
||||
"index_primary_key_already_exists" => v5::Code::PrimaryKeyAlreadyPresent,
|
||||
"max_fields_limit_exceeded" => v5::Code::MaxFieldsLimitExceeded,
|
||||
"missing_document_id" => v5::Code::MissingDocumentId,
|
||||
"invalid_document_id" => v5::Code::InvalidDocumentId,
|
||||
"invalid_filter" => v5::Code::Filter,
|
||||
"invalid_sort" => v5::Code::Sort,
|
||||
"bad_parameter" => v5::Code::BadParameter,
|
||||
"bad_request" => v5::Code::BadRequest,
|
||||
"database_size_limit_reached" => v5::Code::DatabaseSizeLimitReached,
|
||||
"document_not_found" => v5::Code::DocumentNotFound,
|
||||
"internal" => v5::Code::Internal,
|
||||
"invalid_geo_field" => v5::Code::InvalidGeoField,
|
||||
"invalid_ranking_rule" => v5::Code::InvalidRankingRule,
|
||||
"invalid_store_file" => v5::Code::InvalidStore,
|
||||
"invalid_api_key" => v5::Code::InvalidToken,
|
||||
"missing_authorization_header" => v5::Code::MissingAuthorizationHeader,
|
||||
"no_space_left_on_device" => v5::Code::NoSpaceLeftOnDevice,
|
||||
"dump_not_found" => v5::Code::DumpNotFound,
|
||||
"task_not_found" => v5::Code::TaskNotFound,
|
||||
"payload_too_large" => v5::Code::PayloadTooLarge,
|
||||
"unretrievable_document" => v5::Code::RetrieveDocument,
|
||||
"search_error" => v5::Code::SearchDocuments,
|
||||
"unsupported_media_type" => v5::Code::UnsupportedMediaType,
|
||||
"dump_already_processing" => v5::Code::DumpAlreadyInProgress,
|
||||
"dump_process_failed" => v5::Code::DumpProcessFailed,
|
||||
"invalid_content_type" => v5::Code::InvalidContentType,
|
||||
"missing_content_type" => v5::Code::MissingContentType,
|
||||
"malformed_payload" => v5::Code::MalformedPayload,
|
||||
"missing_payload" => v5::Code::MissingPayload,
|
||||
"api_key_not_found" => v5::Code::ApiKeyNotFound,
|
||||
"missing_parameter" => v5::Code::MissingParameter,
|
||||
"invalid_api_key_actions" => v5::Code::InvalidApiKeyActions,
|
||||
"invalid_api_key_indexes" => v5::Code::InvalidApiKeyIndexes,
|
||||
"invalid_api_key_expires_at" => v5::Code::InvalidApiKeyExpiresAt,
|
||||
"invalid_api_key_description" => v5::Code::InvalidApiKeyDescription,
|
||||
other => {
|
||||
log::warn!("Unknown error code {}", other);
|
||||
v5::Code::UnretrievableErrorCode
|
||||
|
@ -251,52 +251,52 @@ impl<T> From<v5::Setting<T>> for v6::Setting<T> {
|
||||
impl From<v5::ResponseError> for v6::ResponseError {
|
||||
fn from(error: v5::ResponseError) -> Self {
|
||||
let code = match error.error_code.as_ref() {
|
||||
"CreateIndex" => v6::Code::CreateIndex,
|
||||
"IndexAlreadyExists" => v6::Code::IndexAlreadyExists,
|
||||
"IndexNotFound" => v6::Code::IndexNotFound,
|
||||
"InvalidIndexUid" => v6::Code::InvalidIndexUid,
|
||||
"InvalidMinWordLengthForTypo" => v6::Code::InvalidMinWordLengthForTypo,
|
||||
"InvalidState" => v6::Code::InvalidState,
|
||||
"MissingPrimaryKey" => v6::Code::MissingPrimaryKey,
|
||||
"PrimaryKeyAlreadyPresent" => v6::Code::PrimaryKeyAlreadyPresent,
|
||||
"MaxFieldsLimitExceeded" => v6::Code::MaxFieldsLimitExceeded,
|
||||
"MissingDocumentId" => v6::Code::MissingDocumentId,
|
||||
"InvalidDocumentId" => v6::Code::InvalidDocumentId,
|
||||
"Filter" => v6::Code::Filter,
|
||||
"Sort" => v6::Code::Sort,
|
||||
"BadParameter" => v6::Code::BadParameter,
|
||||
"BadRequest" => v6::Code::BadRequest,
|
||||
"DatabaseSizeLimitReached" => v6::Code::DatabaseSizeLimitReached,
|
||||
"DocumentNotFound" => v6::Code::DocumentNotFound,
|
||||
"Internal" => v6::Code::Internal,
|
||||
"InvalidGeoField" => v6::Code::InvalidGeoField,
|
||||
"InvalidRankingRule" => v6::Code::InvalidRankingRule,
|
||||
"InvalidStore" => v6::Code::InvalidStore,
|
||||
"InvalidToken" => v6::Code::InvalidToken,
|
||||
"MissingAuthorizationHeader" => v6::Code::MissingAuthorizationHeader,
|
||||
"NoSpaceLeftOnDevice" => v6::Code::NoSpaceLeftOnDevice,
|
||||
"DumpNotFound" => v6::Code::DumpNotFound,
|
||||
"TaskNotFound" => v6::Code::TaskNotFound,
|
||||
"PayloadTooLarge" => v6::Code::PayloadTooLarge,
|
||||
"RetrieveDocument" => v6::Code::RetrieveDocument,
|
||||
"SearchDocuments" => v6::Code::SearchDocuments,
|
||||
"UnsupportedMediaType" => v6::Code::UnsupportedMediaType,
|
||||
"DumpAlreadyInProgress" => v6::Code::DumpAlreadyInProgress,
|
||||
"DumpProcessFailed" => v6::Code::DumpProcessFailed,
|
||||
"InvalidContentType" => v6::Code::InvalidContentType,
|
||||
"MissingContentType" => v6::Code::MissingContentType,
|
||||
"MalformedPayload" => v6::Code::MalformedPayload,
|
||||
"MissingPayload" => v6::Code::MissingPayload,
|
||||
"ApiKeyNotFound" => v6::Code::ApiKeyNotFound,
|
||||
"MissingParameter" => v6::Code::MissingParameter,
|
||||
"InvalidApiKeyActions" => v6::Code::InvalidApiKeyActions,
|
||||
"InvalidApiKeyIndexes" => v6::Code::InvalidApiKeyIndexes,
|
||||
"InvalidApiKeyExpiresAt" => v6::Code::InvalidApiKeyExpiresAt,
|
||||
"InvalidApiKeyDescription" => v6::Code::InvalidApiKeyDescription,
|
||||
"InvalidApiKeyName" => v6::Code::InvalidApiKeyName,
|
||||
"InvalidApiKeyUid" => v6::Code::InvalidApiKeyUid,
|
||||
"ImmutableField" => v6::Code::ImmutableField,
|
||||
"ApiKeyAlreadyExists" => v6::Code::ApiKeyAlreadyExists,
|
||||
"index_creation_failed" => v6::Code::CreateIndex,
|
||||
"index_already_exists" => v6::Code::IndexAlreadyExists,
|
||||
"index_not_found" => v6::Code::IndexNotFound,
|
||||
"invalid_index_uid" => v6::Code::InvalidIndexUid,
|
||||
"invalid_min_word_length_for_typo" => v6::Code::InvalidMinWordLengthForTypo,
|
||||
"invalid_state" => v6::Code::InvalidState,
|
||||
"primary_key_inference_failed" => v6::Code::MissingPrimaryKey,
|
||||
"index_primary_key_already_exists" => v6::Code::PrimaryKeyAlreadyPresent,
|
||||
"max_fields_limit_exceeded" => v6::Code::MaxFieldsLimitExceeded,
|
||||
"missing_document_id" => v6::Code::MissingDocumentId,
|
||||
"invalid_document_id" => v6::Code::InvalidDocumentId,
|
||||
"invalid_filter" => v6::Code::Filter,
|
||||
"invalid_sort" => v6::Code::Sort,
|
||||
"bad_parameter" => v6::Code::BadParameter,
|
||||
"bad_request" => v6::Code::BadRequest,
|
||||
"database_size_limit_reached" => v6::Code::DatabaseSizeLimitReached,
|
||||
"document_not_found" => v6::Code::DocumentNotFound,
|
||||
"internal" => v6::Code::Internal,
|
||||
"invalid_geo_field" => v6::Code::InvalidGeoField,
|
||||
"invalid_ranking_rule" => v6::Code::InvalidRankingRule,
|
||||
"invalid_store_file" => v6::Code::InvalidStore,
|
||||
"invalid_api_key" => v6::Code::InvalidToken,
|
||||
"missing_authorization_header" => v6::Code::MissingAuthorizationHeader,
|
||||
"no_space_left_on_device" => v6::Code::NoSpaceLeftOnDevice,
|
||||
"dump_not_found" => v6::Code::DumpNotFound,
|
||||
"task_not_found" => v6::Code::TaskNotFound,
|
||||
"payload_too_large" => v6::Code::PayloadTooLarge,
|
||||
"unretrievable_document" => v6::Code::RetrieveDocument,
|
||||
"search_error" => v6::Code::SearchDocuments,
|
||||
"unsupported_media_type" => v6::Code::UnsupportedMediaType,
|
||||
"dump_already_processing" => v6::Code::DumpAlreadyInProgress,
|
||||
"dump_process_failed" => v6::Code::DumpProcessFailed,
|
||||
"invalid_content_type" => v6::Code::InvalidContentType,
|
||||
"missing_content_type" => v6::Code::MissingContentType,
|
||||
"malformed_payload" => v6::Code::MalformedPayload,
|
||||
"missing_payload" => v6::Code::MissingPayload,
|
||||
"api_key_not_found" => v6::Code::ApiKeyNotFound,
|
||||
"missing_parameter" => v6::Code::MissingParameter,
|
||||
"invalid_api_key_actions" => v6::Code::InvalidApiKeyActions,
|
||||
"invalid_api_key_indexes" => v6::Code::InvalidApiKeyIndexes,
|
||||
"invalid_api_key_expires_at" => v6::Code::InvalidApiKeyExpiresAt,
|
||||
"invalid_api_key_description" => v6::Code::InvalidApiKeyDescription,
|
||||
"invalid_api_key_name" => v6::Code::InvalidApiKeyName,
|
||||
"invalid_api_key_uid" => v6::Code::InvalidApiKeyUid,
|
||||
"immutable_field" => v6::Code::ImmutableField,
|
||||
"api_key_already_exists" => v6::Code::ApiKeyAlreadyExists,
|
||||
other => {
|
||||
log::warn!("Unknown error code {}", other);
|
||||
v6::Code::UnretrievableErrorCode
|
||||
|
Loading…
x
Reference in New Issue
Block a user