diff --git a/crates/gpapi/src/error.rs b/crates/gpapi/src/error.rs index b1f578c..f46be52 100644 --- a/crates/gpapi/src/error.rs +++ b/crates/gpapi/src/error.rs @@ -2,7 +2,7 @@ use thiserror::Error; #[derive(Error, Debug)] pub enum PortalError { - #[error("Portal prelogin error: {0}")] + #[error("Prelogin error: {0}")] PreloginError(String), #[error("Portal config error: {0}")] ConfigError(String), diff --git a/crates/gpapi/src/portal/prelogin.rs b/crates/gpapi/src/portal/prelogin.rs index bc583c5..fc13fdb 100644 --- a/crates/gpapi/src/portal/prelogin.rs +++ b/crates/gpapi/src/portal/prelogin.rs @@ -139,20 +139,23 @@ pub async fn prelogin(portal: &str, gp_params: &GpParams) -> anyhow::Result anyhow::Result { - let doc = Document::parse(&res_xml)?; +fn parse_res_xml(res_xml: &str, is_gateway: bool) -> anyhow::Result { + let doc = Document::parse(res_xml)?; let status = xml::get_child_text(&doc, "status") .ok_or_else(|| anyhow::anyhow!("Prelogin response does not contain status element"))?; // Check the status of the prelogin response if status.to_uppercase() != "SUCCESS" { let msg = xml::get_child_text(&doc, "msg").unwrap_or(String::from("Unknown error")); - bail!("Prelogin failed: {}", msg) + bail!("{}", msg) } let region = xml::get_child_text(&doc, "region").unwrap_or_else(|| {