async fn search_user(&self, change_owner: &str) -> Result<Option<ProfileId>, String> {
        let search = [
            change_owner,
            user_firstname(change_owner),
            user_lastname(change_owner),
        ];
        for s in search.iter() {
            let request_result = self.request_users(s).await;
            if request_result.is_err() {
                error!("API request failed.");
                return Err(String::from("Error when searching for user."));
            }

            let result = request_result.unwrap();
            if result.is_some() {
                debug!("Found search result for '{}'.", s);
                return Ok(result);
            }

            debug!("Search for user with search '{}' returned no result.", s);
        }

        return Ok(None);
    }
// I think the error message is related to the change_owner and not the token.
// The result/error message should be valid until the change_owner that called the function
// is no longer valid.
I think the error message is related to the change_owner and not the token.
The result/error message should be valid until the change_owner that called the function
is no longer valid.
I think the error message is related to the change_owner and not the token . The result / error message should be valid until the change_owner that called the function is no longer valid .
async fn search_user(&self, change_owner: &str) -> Result<Option<ProfileId>, String> {
        let search = [
            change_owner,
            user_firstname(change_owner),
            user_lastname(change_owner),
        ];
        for s in search.iter() {
            let request_result = self.request_users(s).await;
            if request_result.is_err() {
                error!("API request failed.");
                return Err(String::from("Error when searching for user."));
            }
            let result = request_result.unwrap();
            if result.is_some() {
                debug!("Found search result for '{}'.", s);
                return Ok(result);
            }
            debug!("Search for user with search '{}' returned no result.", s);
        }
        return Ok(None);
    }
async fn search_user ( & self , change_owner : & str ) -> Result < Option < ProfileId > , String > { let search = [ change_owner , user_firstname ( change_owner ) , user_lastname ( change_owner ) , ] ; for s in search . iter ( ) { let request_result = self . request_users ( s ) . await ; if request_result . is_err ( ) { error ! ( " " ) ; return Err ( String :: from ( " " ) ) ; } let result = request_result . unwrap ( ) ; if result . is_some ( ) { debug ! ( " " s ) ; return Ok ( result ) ; } debug ! ( " " s ) ; } return Ok ( None ) ; }
I think the error message is related to the change_owner and not the token.
I think the error message is related to the change_owner and not the token .
&self
change_owner
&str
&self
change_owner
&str