mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-29 07:59:00 +00:00
init: provide more info when workspace init fails
We classified all errors from initialization as "The target repo already exists". That's incorrect when the error came from the backend.
This commit is contained in:
parent
e2a5a14463
commit
086398dd55
1 changed files with 15 additions and 2 deletions
|
@ -137,8 +137,21 @@ impl From<BackendError> for CommandError {
|
|||
}
|
||||
|
||||
impl From<WorkspaceInitError> for CommandError {
|
||||
fn from(_: WorkspaceInitError) -> Self {
|
||||
user_error("The target repo already exists")
|
||||
fn from(err: WorkspaceInitError) -> Self {
|
||||
match err {
|
||||
WorkspaceInitError::DestinationExists(_) => {
|
||||
user_error("The target repo already exists")
|
||||
}
|
||||
WorkspaceInitError::NonUnicodePath => {
|
||||
user_error("The target repo path contains non-unicode characters")
|
||||
}
|
||||
WorkspaceInitError::CheckOutCommit(err) => CommandError::InternalError(format!(
|
||||
"Failed to check out the initial commit: {err}"
|
||||
)),
|
||||
WorkspaceInitError::Path(err) => {
|
||||
CommandError::InternalError(format!("Failed to access the repository: {err}"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue