Support for using a master key (#83)

* Support for using a master key

* Expand scope of PR, add wrapper struct, add files to intitial versions/mods

* Change changelog path, run formatter

* Split file changes into different PR

* Formatting, rename main variable

Co-authored-by: Aeledfyr <aeledfyr@gmail.com>
This commit is contained in:
Geometrically
2020-10-19 14:23:05 -07:00
committed by GitHub
parent e0b972f6d6
commit c886e7949e
8 changed files with 75 additions and 25 deletions

View File

@@ -60,6 +60,8 @@ pub enum ApiError {
JsonError(#[from] serde_json::Error),
#[error("Authentication Error")]
AuthenticationError,
#[error("Search Error: {0}")]
SearchError(#[from] meilisearch_sdk::errors::Error),
}
impl actix_web::ResponseError for ApiError {
@@ -68,6 +70,7 @@ impl actix_web::ResponseError for ApiError {
ApiError::DatabaseError(..) => actix_web::http::StatusCode::INTERNAL_SERVER_ERROR,
ApiError::AuthenticationError => actix_web::http::StatusCode::UNAUTHORIZED,
ApiError::JsonError(..) => actix_web::http::StatusCode::BAD_REQUEST,
ApiError::SearchError(..) => actix_web::http::StatusCode::INTERNAL_SERVER_ERROR,
}
}
@@ -78,6 +81,7 @@ impl actix_web::ResponseError for ApiError {
ApiError::DatabaseError(..) => "database_error",
ApiError::AuthenticationError => "unauthorized",
ApiError::JsonError(..) => "json_error",
ApiError::SearchError(..) => "search_error",
},
description: &self.to_string(),
},