mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-29 12:33:49 +03:00
handle http error when pushing/pulling project
This commit is contained in:
parent
2b1c7d21c1
commit
1cb49179d2
@ -16,6 +16,8 @@ pub enum Error {
|
|||||||
Network(git2::Error),
|
Network(git2::Error),
|
||||||
#[error("hook error: {0}")]
|
#[error("hook error: {0}")]
|
||||||
Hooks(#[from] git2_hooks::HooksError),
|
Hooks(#[from] git2_hooks::HooksError),
|
||||||
|
#[error("http error: {0}")]
|
||||||
|
Http(git2::Error),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
Other(git2::Error),
|
Other(git2::Error),
|
||||||
}
|
}
|
||||||
@ -27,6 +29,7 @@ impl From<git2::Error> for Error {
|
|||||||
git2::ErrorCode::GenericError | git2::ErrorCode::Auth => Error::Auth(err),
|
git2::ErrorCode::GenericError | git2::ErrorCode::Auth => Error::Auth(err),
|
||||||
_ => Error::Other(err),
|
_ => Error::Other(err),
|
||||||
},
|
},
|
||||||
|
git2::ErrorClass::Http => Error::Http(err),
|
||||||
git2::ErrorClass::Net => Error::Network(err),
|
git2::ErrorClass::Net => Error::Network(err),
|
||||||
_ => match err.code() {
|
_ => match err.code() {
|
||||||
git2::ErrorCode::NotFound => Error::NotFound(err),
|
git2::ErrorCode::NotFound => Error::NotFound(err),
|
||||||
|
@ -370,12 +370,12 @@ impl Repository {
|
|||||||
);
|
);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
Err(git::Error::Auth(error)) => {
|
Err(git::Error::Auth(error) | git::Error::Http(error)) => {
|
||||||
tracing::warn!(project_id = %self.project.id, ?error, "git push failed",);
|
tracing::warn!(project_id = %self.project.id, ?error, "git push failed");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Err(git::Error::Network(error)) => {
|
Err(git::Error::Network(error)) => {
|
||||||
tracing::warn!(project_id = %self.project.id, ?error, "git push failed",);
|
tracing::warn!(project_id = %self.project.id, ?error, "git push failed");
|
||||||
return Err(RemoteError::Network);
|
return Err(RemoteError::Network);
|
||||||
}
|
}
|
||||||
Err(error) => return Err(RemoteError::Other(error.into())),
|
Err(error) => return Err(RemoteError::Other(error.into())),
|
||||||
@ -407,7 +407,7 @@ impl Repository {
|
|||||||
tracing::info!(project_id = %self.project.id, %refspec, "git fetched");
|
tracing::info!(project_id = %self.project.id, %refspec, "git fetched");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
Err(git::Error::Auth(error)) => {
|
Err(git::Error::Auth(error) | git::Error::Http(error)) => {
|
||||||
tracing::warn!(project_id = %self.project.id, ?error, "fetch failed");
|
tracing::warn!(project_id = %self.project.id, ?error, "fetch failed");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user