Handle portal endpoint network error

This commit is contained in:
Kevin Yue
2024-03-29 00:00:03 -04:00
parent 187ca778f2
commit 79e0f0c7c1
6 changed files with 23 additions and 7 deletions

View File

@@ -102,7 +102,12 @@ pub async fn retrieve_config(portal: &str, cred: &Credential, gp_params: &GpPara
info!("Portal config, user_agent: {}", gp_params.user_agent());
let res = client.post(&url).form(&params).send().await?;
let res = client
.post(&url)
.form(&params)
.send()
.await
.map_err(|e| anyhow::anyhow!(PortalError::NetworkError(e.to_string())))?;
let status = res.status();
if status == StatusCode::NOT_FOUND {