ok/jj
1
0
Fork 0
forked from mirrors/jj

cli: include message from GitExportError to user

I'm going to add other error variants for when we fail to read/write
to disk, and I don't think we need to have a custom message for each
in the CLI crate. It's easier to pass along the message from the lib
crate.

(`ConflictedBranch`, on the other hand, is an expected error so I
think we should continue to let let the CLI crate define the error
message for it.)
This commit is contained in:
Martin von Zweigbergk 2022-10-27 23:15:18 -07:00 committed by Martin von Zweigbergk
parent 80aaf6c0e0
commit 10343876fa
2 changed files with 2 additions and 2 deletions

View file

@ -166,7 +166,7 @@ pub fn import_refs(
pub enum GitExportError {
#[error("Cannot export conflicted branch '{0}'")]
ConflictedBranch(String),
#[error("Unexpected git error when exporting refs: {0}")]
#[error("Git error: {0}")]
InternalGitError(#[from] git2::Error),
}

View file

@ -169,7 +169,7 @@ impl From<GitExportError> for CommandError {
GitExportError::ConflictedBranch(branch_name) => {
user_error(format!("Cannot export conflicted branch '{branch_name}'"))
}
GitExportError::InternalGitError(err) => CommandError::InternalError(format!(
err => CommandError::InternalError(format!(
"Failed to export refs to underlying Git repo: {err}"
)),
}