| 58 | } |
| 59 | |
| 60 | fn status_code(&self) -> StatusCode { |
| 61 | match self { |
| 62 | Self::NotFound(_) => StatusCode::NOT_FOUND, |
| 63 | Self::FailedToGetAppEnv => StatusCode::INTERNAL_SERVER_ERROR, |
| 64 | Self::CollectionNotFound => StatusCode::NOT_FOUND, |
| 65 | Self::FailedToCreateIndex(_) => StatusCode::BAD_REQUEST, |
| 66 | Self::IndexAlreadyExists(_) => StatusCode::CONFLICT, |
| 67 | Self::FailedToDeleteIndex(_) => StatusCode::INTERNAL_SERVER_ERROR, |
| 68 | Self::InvalidIndexType(_) => StatusCode::BAD_REQUEST, |
| 69 | Self::WaCustom(_) => StatusCode::INTERNAL_SERVER_ERROR, |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | impl From<WaCustomError> for IndexesError { |