diff --git a/services/identity/src/database.rs b/services/identity/src/database.rs --- a/services/identity/src/database.rs +++ b/services/identity/src/database.rs @@ -597,13 +597,13 @@ let user_id = first_item .get(USERS_TABLE_PARTITION_KEY) .ok_or(DBItemError { - attribute_name: USERS_TABLE_PARTITION_KEY, + attribute_name: USERS_TABLE_PARTITION_KEY.to_string(), attribute_value: None, attribute_error: DBItemAttributeError::Missing, })? .as_s() .map_err(|_| DBItemError { - attribute_name: USERS_TABLE_PARTITION_KEY, + attribute_name: USERS_TABLE_PARTITION_KEY.to_string(), attribute_value: first_item.get(USERS_TABLE_PARTITION_KEY).cloned(), attribute_error: DBItemAttributeError::IncorrectType, })?; @@ -864,14 +864,14 @@ if let Some(AttributeValue::S(created)) = &attribute { created.parse().map_err(|e| { DBItemError::new( - ACCESS_TOKEN_TABLE_CREATED_ATTRIBUTE, + ACCESS_TOKEN_TABLE_CREATED_ATTRIBUTE.to_string(), attribute, DBItemAttributeError::InvalidTimestamp(e), ) }) } else { Err(DBItemError::new( - ACCESS_TOKEN_TABLE_CREATED_ATTRIBUTE, + ACCESS_TOKEN_TABLE_CREATED_ATTRIBUTE.to_string(), attribute, DBItemAttributeError::Missing, )) @@ -886,14 +886,14 @@ "password" => Ok(AuthType::Password), "wallet" => Ok(AuthType::Wallet), _ => Err(DBItemError::new( - ACCESS_TOKEN_TABLE_AUTH_TYPE_ATTRIBUTE, + ACCESS_TOKEN_TABLE_AUTH_TYPE_ATTRIBUTE.to_string(), attribute, DBItemAttributeError::IncorrectType, )), } } else { Err(DBItemError::new( - ACCESS_TOKEN_TABLE_AUTH_TYPE_ATTRIBUTE, + ACCESS_TOKEN_TABLE_AUTH_TYPE_ATTRIBUTE.to_string(), attribute, DBItemAttributeError::Missing, )) @@ -906,12 +906,12 @@ match attribute { Some(AttributeValue::Bool(valid)) => Ok(valid), Some(_) => Err(DBItemError::new( - ACCESS_TOKEN_TABLE_VALID_ATTRIBUTE, + ACCESS_TOKEN_TABLE_VALID_ATTRIBUTE.to_string(), attribute, DBItemAttributeError::IncorrectType, )), None => Err(DBItemError::new( - ACCESS_TOKEN_TABLE_VALID_ATTRIBUTE, + ACCESS_TOKEN_TABLE_VALID_ATTRIBUTE.to_string(), attribute, DBItemAttributeError::Missing, )), @@ -924,12 +924,12 @@ match attribute { Some(AttributeValue::S(token)) => Ok(token), Some(_) => Err(DBItemError::new( - ACCESS_TOKEN_TABLE_TOKEN_ATTRIBUTE, + ACCESS_TOKEN_TABLE_TOKEN_ATTRIBUTE.to_string(), attribute, DBItemAttributeError::IncorrectType, )), None => Err(DBItemError::new( - ACCESS_TOKEN_TABLE_TOKEN_ATTRIBUTE, + ACCESS_TOKEN_TABLE_TOKEN_ATTRIBUTE.to_string(), attribute, DBItemAttributeError::Missing, )), @@ -944,12 +944,12 @@ Ok(server_registration_bytes.into_inner()) } Some(_) => Err(DBItemError::new( - USERS_TABLE_REGISTRATION_ATTRIBUTE, + USERS_TABLE_REGISTRATION_ATTRIBUTE.to_string(), attribute, DBItemAttributeError::IncorrectType, )), None => Err(DBItemError::new( - USERS_TABLE_REGISTRATION_ATTRIBUTE, + USERS_TABLE_REGISTRATION_ATTRIBUTE.to_string(), attribute, DBItemAttributeError::Missing, )), @@ -963,12 +963,12 @@ match attribute_value { Some(AttributeValue::M(map)) => Ok(map), Some(_) => Err(DBItemError::new( - attribute_name, + attribute_name.to_string(), attribute_value, DBItemAttributeError::IncorrectType, )), None => Err(DBItemError::new( - attribute_name, + attribute_name.to_string(), attribute_value, DBItemAttributeError::Missing, )), @@ -982,12 +982,12 @@ match attribute_value { Some(AttributeValue::S(value)) => Ok(value), Some(_) => Err(DBItemError::new( - attribute_name, + attribute_name.to_string(), attribute_value, DBItemAttributeError::IncorrectType, )), None => Err(DBItemError::new( - attribute_name, + attribute_name.to_string(), attribute_value, DBItemAttributeError::Missing, )), diff --git a/services/identity/src/error.rs b/services/identity/src/error.rs --- a/services/identity/src/error.rs +++ b/services/identity/src/error.rs @@ -15,7 +15,7 @@ #[derive(Debug, derive_more::Error, derive_more::Constructor)] pub struct DBItemError { - pub attribute_name: &'static str, + pub attribute_name: String, pub attribute_value: Option, pub attribute_error: DBItemAttributeError, }