fn parse_response<'a, T: Deserialize<'a>>(response_text: &'a str) -> Result<T, SpaceTradersClientError> {
    match serde_json::from_str::<T>(&response_text) {
        Ok(o) => Ok(o),
        Err(e) => {
            log::error!("Error processing type {:?}: {}", std::any::type_name::<T>(), e);
            log::error!("Error response: {}", &response_text);

            match serde_json::from_str::<shared::ErrorMessage>(&response_text) {
                Ok(error_message) => Err(SpaceTradersClientError::ApiError(error_message)),
                Err(e) => Err(SpaceTradersClientError::JsonParse(e)),
            }
        }
    }
}
/// Parse a response string into the type represented by T
/// If the `response_text` cannot be parsed into type T then it is assumed that an error
/// occurred and an shared::ErrorMessage will be returned
///
/// # Arguments
///
/// * `response_text` - A string containing the JSON response to be parsed
Parse a response string into the type represented by T
If the `response_text` cannot be parsed into type T then it is assumed that an error
occurred and an shared::ErrorMessage will be returned
Parse a response string into the type represented by T If the ` response_text ` cannot be parsed into type T then it is assumed that an error occurred and an shared :: ErrorMessage will be returned
fn parse_response<'a, T: Deserialize<'a>>(response_text: &'a str) -> Result<T, SpaceTradersClientError> {
    match serde_json::from_str::<T>(&response_text) {
        Ok(o) => Ok(o),
        Err(e) => {
            log::error!("Error processing type {:?}: {}", std::any::type_name::<T>(), e);
            log::error!("Error response: {}", &response_text);
            match serde_json::from_str::<shared::ErrorMessage>(&response_text) {
                Ok(error_message) => Err(SpaceTradersClientError::ApiError(error_message)),
                Err(e) => Err(SpaceTradersClientError::JsonParse(e)),
            }
        }
    }
}
fn parse_response < ' a , T : Deserialize < ' a > > ( response_text : & ' a str ) -> Result < T , SpaceTradersClientError > { match serde_json :: from_str :: < T > ( & response_text ) { Ok ( o ) => Ok ( o ) , Err ( e ) => { log :: error ! ( " " std any type_name T ( ) e ) ; log :: error ! ( " " response_text ) ; match serde_json :: from_str :: < shared :: ErrorMessage > ( & response_text ) { Ok ( error_message ) => Err ( SpaceTradersClientError :: ApiError ( error_message ) ) , Err ( e ) => Err ( SpaceTradersClientError :: JsonParse ( e ) ) , } } } }
Parse a response string into the type represented by T
If the `response_text` cannot be parsed into type T then it is assumed that an error
occurred and an shared::ErrorMessage will be returned
Parse a response string into the type represented by T If the ` response_text ` cannot be parsed into type T then it is assumed that an error occurred and an shared :: ErrorMessage will be returned
response_text
&'a str
response_text
&'a str