mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 04:17:10 +02:00
error codes for core
This commit is contained in:
parent
0e20ac28e5
commit
9c58ca7ce5
2 changed files with 59 additions and 11 deletions
|
@ -36,8 +36,27 @@ pub enum Error {
|
|||
|
||||
impl ErrorCode for Error {
|
||||
fn error_code(&self) -> Code {
|
||||
//TODO populate codes
|
||||
Code::Internal
|
||||
use Error::*;
|
||||
|
||||
match self {
|
||||
FacetError(_) => Code::Facet,
|
||||
FilterParseError(_) => Code::Filter,
|
||||
UnsupportedOperation(_) => Code::BadRequest,
|
||||
IndexAlreadyExists => Code::IndexAlreadyExists,
|
||||
MissingPrimaryKey => Code::InvalidState,
|
||||
MissingDocumentId => Code::MissingDocumentId,
|
||||
MaxFieldsLimitExceeded => Code::MaxFieldsLimitExceeded,
|
||||
Schema(s) => s.error_code(),
|
||||
WordIndexMissing
|
||||
| SchemaMissing => Code::InvalidState,
|
||||
Heed(_)
|
||||
| Fst(_)
|
||||
| SerdeJson(_)
|
||||
| Bincode(_)
|
||||
| Serializer(_)
|
||||
| Deserializer(_)
|
||||
| Io(_) => Code::Internal,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue