From 0a555060773a3f4f4faf1e2da1f5cd264896bb31 Mon Sep 17 00:00:00 2001 From: Kevin Yue Date: Thu, 1 Feb 2024 21:52:31 +0800 Subject: [PATCH] Do not error when region is not found --- crates/gpapi/src/portal/prelogin.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/gpapi/src/portal/prelogin.rs b/crates/gpapi/src/portal/prelogin.rs index 2a218b88..4f1d1335 100644 --- a/crates/gpapi/src/portal/prelogin.rs +++ b/crates/gpapi/src/portal/prelogin.rs @@ -150,8 +150,10 @@ fn parse_res_xml(res_xml: String, is_gateway: bool) -> anyhow::Result bail!("Prelogin failed: {}", msg) } - let region = xml::get_child_text(&doc, "region") - .ok_or_else(|| anyhow::anyhow!("Prelogin response does not contain region element"))?; + let region = xml::get_child_text(&doc, "region").unwrap_or_else(|| { + info!("Prelogin response does not contain region element"); + String::from("Unknown") + }); let saml_method = xml::get_child_text(&doc, "saml-auth-method"); let saml_request = xml::get_child_text(&doc, "saml-request");