diff --git a/techtree-manager/src/main.rs b/techtree-manager/src/main.rs index d9e2f81..cba851d 100644 --- a/techtree-manager/src/main.rs +++ b/techtree-manager/src/main.rs @@ -60,14 +60,21 @@ async fn run() -> anyhow::Result<()> { "{}/{}", meta.issue.repository.owner, meta.issue.repository.name )) - .expect("TODO"); + .with_context(|| { + format!("failed building repository URL from GITHUB_SERVER_URL: {server_url}") + })?; - let repo_auth_url = token.as_ref().map(|token| { - let mut repo_auth_url = repo_url.clone(); - repo_auth_url.set_username("forgejo-actions").expect("TODO"); - repo_auth_url.set_password(Some(&token)).expect("TODO"); - repo_auth_url - }); + let repo_auth_url = token + .as_ref() + .map(|token| -> Result<_, ()> { + let mut repo_auth_url = repo_url.clone(); + repo_auth_url.set_username("forgejo-actions")?; + repo_auth_url.set_password(Some(&token))?; + Ok(repo_auth_url) + }) + .transpose() + .map_err(|_e| anyhow::anyhow!("Repo URL does not have correct format")) + .context("Failed adding auth info to repo URL")?; let auth = if let Some(token) = token.as_ref() { forgejo_api::Auth::Token(token)