refactor: remove unused git branch error
All checks were successful
Rust / build (push) Successful in 1m27s
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
ci/woodpecker/cron/cron-docker-builder Pipeline was successful
ci/woodpecker/cron/push-next Pipeline was successful
ci/woodpecker/cron/tag-created Pipeline was successful

This commit is contained in:
Paul Campbell 2024-05-23 20:52:16 +01:00
parent 4cd797ac0a
commit 0202be19fe
2 changed files with 4 additions and 12 deletions

View file

@ -2,7 +2,6 @@ use git_next_config as config;
use git_next_git as git; use git_next_git as git;
use kxio::network::{self, Network}; use kxio::network::{self, Network};
use tracing::error;
pub async fn get_all( pub async fn get_all(
repo_details: &git::RepoDetails, repo_details: &git::RepoDetails,
@ -16,7 +15,6 @@ pub async fn get_all(
"https://{hostname}/api/v1/repos/{repo_path}/branches?token={token}" "https://{hostname}/api/v1/repos/{repo_path}/branches?token={token}"
)); ));
// info!(%url, "Listing branches");
let request = network::NetRequest::new( let request = network::NetRequest::new(
network::RequestMethod::Get, network::RequestMethod::Get,
url, url,
@ -26,11 +24,7 @@ pub async fn get_all(
None, None,
network::NetRequestLogging::None, network::NetRequestLogging::None,
); );
let result = net.get::<Vec<Branch>>(request).await; let response = net.get::<Vec<Branch>>(request).await?;
let response = result.map_err(|e| {
error!(?e, "Failed to list branches");
git::branch::Error::NoneFound // BranchListNotAvailable
})?;
let branches = response let branches = response
.response_body() .response_body()
.unwrap_or_default() .unwrap_or_default()

View file

@ -1,8 +1,6 @@
#[derive(Debug, derive_more::Display)] #[derive(Debug, derive_more::Display, derive_more::From)]
pub enum Error { pub enum Error {
#[display("Branch not found: {}", 0)] #[display("network: {}", 0)]
NotFound(git_next_config::BranchName), Network(kxio::network::NetworkError),
#[display("Unable to find any branches")]
NoneFound,
} }
impl std::error::Error for Error {} impl std::error::Error for Error {}