Skip to content

Commit

Permalink
Change stucts and fields documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
tonycdot committed Sep 10, 2021
1 parent 2e3613b commit 203be3a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions crates/facetec-api-client/src/facetec_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ mod tests {

assert_eq!(response, expected_error);
}

#[test]
fn correct_response_with_excess_error_message() {
use crate::db_enroll::Response;
Expand Down
6 changes: 3 additions & 3 deletions crates/facetec-api-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ pub enum Error {
Reqwest(#[from] reqwest::Error),
}

/// The generic error response.
/// An error response originating from the FaceTec Server itself.
#[derive(Error, Debug, Deserialize)]
#[error("server error: {error_message}")]
pub struct ServerError {
/// An error from server response.
/// A human-readable message characterizing the error.
#[serde(rename = "errorMessage")]
pub error_message: String,
}
Expand Down Expand Up @@ -139,7 +139,7 @@ where
}
}

/// An custom JSON parsing logic for common response.
/// Parse a FaceTec Server response or generate a parsing error.
async fn parse_response<T>(&self, res: Response) -> Result<T, crate::Error>
where
T: for<'de> Deserialize<'de> + std::fmt::Debug,
Expand Down
4 changes: 2 additions & 2 deletions crates/robonode-server/src/logic/facetec_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ pub fn db_search_result_adapter(
) -> DbSearchResult {
match search_res {
Ok(res) => DbSearchResult::Response(res),
Err(ft::Error::Server(ft::ServerError { error_message: err }))
if err
Err(ft::Error::Server(ft::ServerError { error_message }))
if error_message
.starts_with("Tried to search a groupName when that groupName does not exist.") =>
{
DbSearchResult::NoGroupError
Expand Down

0 comments on commit 203be3a

Please sign in to comment.