refactor: remove unused git branch error

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 kxio::network::{self, Network};
use tracing::error;
pub async fn get_all(
repo_details: &git::RepoDetails,
@ -16,7 +15,6 @@ pub async fn get_all(
"https://{hostname}/api/v1/repos/{repo_path}/branches?token={token}"
));
// info!(%url, "Listing branches");
let request = network::NetRequest::new(
network::RequestMethod::Get,
url,
@ -26,11 +24,7 @@ pub async fn get_all(
None,
network::NetRequestLogging::None,
);
let result = net.get::<Vec<Branch>>(request).await;
let response = result.map_err(|e| {
error!(?e, "Failed to list branches");
git::branch::Error::NoneFound // BranchListNotAvailable
})?;
let response = net.get::<Vec<Branch>>(request).await?;
let branches = response
.response_body()
.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 {
#[display("Branch not found: {}", 0)]
NotFound(git_next_config::BranchName),
#[display("Unable to find any branches")]
NoneFound,
#[display("network: {}", 0)]
Network(kxio::network::NetworkError),
}
impl std::error::Error for Error {}