mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-26 23:04:26 +01:00
update error codes
This commit is contained in:
parent
c9f10432b8
commit
2bf82b3198
@ -76,7 +76,6 @@ pub enum Code {
|
|||||||
RetrieveDocument,
|
RetrieveDocument,
|
||||||
SearchDocuments,
|
SearchDocuments,
|
||||||
UnsupportedMediaType,
|
UnsupportedMediaType,
|
||||||
Other,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Code {
|
impl Code {
|
||||||
@ -94,7 +93,6 @@ impl Code {
|
|||||||
|
|
||||||
// invalid state error
|
// invalid state error
|
||||||
InvalidState => ErrCode::internal("invalid_state", StatusCode::INTERNAL_SERVER_ERROR),
|
InvalidState => ErrCode::internal("invalid_state", StatusCode::INTERNAL_SERVER_ERROR),
|
||||||
// FIXME probably not an internal statuscode there
|
|
||||||
MissingPrimaryKey => ErrCode::internal("missing_primary_key", StatusCode::INTERNAL_SERVER_ERROR),
|
MissingPrimaryKey => ErrCode::internal("missing_primary_key", StatusCode::INTERNAL_SERVER_ERROR),
|
||||||
PrimaryKeyAlreadyPresent => ErrCode::internal("primary_key_already_present", StatusCode::INTERNAL_SERVER_ERROR),
|
PrimaryKeyAlreadyPresent => ErrCode::internal("primary_key_already_present", StatusCode::INTERNAL_SERVER_ERROR),
|
||||||
|
|
||||||
@ -118,7 +116,6 @@ impl Code {
|
|||||||
RetrieveDocument => ErrCode::internal("retrieve_document", StatusCode::BAD_REQUEST),
|
RetrieveDocument => ErrCode::internal("retrieve_document", StatusCode::BAD_REQUEST),
|
||||||
SearchDocuments => ErrCode::internal("search_error", StatusCode::BAD_REQUEST),
|
SearchDocuments => ErrCode::internal("search_error", StatusCode::BAD_REQUEST),
|
||||||
UnsupportedMediaType => ErrCode::invalid("unsupported_media_type", StatusCode::UNSUPPORTED_MEDIA_TYPE),
|
UnsupportedMediaType => ErrCode::invalid("unsupported_media_type", StatusCode::UNSUPPORTED_MEDIA_TYPE),
|
||||||
_ => ErrCode::invalid("other", StatusCode::BAD_REQUEST),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +136,7 @@ impl Code {
|
|||||||
|
|
||||||
/// return the doc url ascociated with the error
|
/// return the doc url ascociated with the error
|
||||||
fn url(&self) -> String {
|
fn url(&self) -> String {
|
||||||
format!("docs.meilisearch.come/error/{}", self.name())
|
format!("docs.meilisearch.com/error/{}", self.name())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +148,6 @@ struct ErrCode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ErrCode {
|
impl ErrCode {
|
||||||
|
|
||||||
fn authentication(err_name: &'static str, status_code: StatusCode) -> ErrCode {
|
fn authentication(err_name: &'static str, status_code: StatusCode) -> ErrCode {
|
||||||
ErrCode {
|
ErrCode {
|
||||||
status_code,
|
status_code,
|
||||||
|
Loading…
Reference in New Issue
Block a user