mirror of
https://github.com/martinvonz/jj.git
synced 2024-10-23 06:57:32 +00:00
cli: map bare io::Error to user error
Suppose the error is emitted from Ui or external command, I don't think io::Error in CLI is an internal error.
This commit is contained in:
parent
ec0f2753ae
commit
8f118074fe
2 changed files with 3 additions and 3 deletions
|
@ -134,7 +134,7 @@ impl From<std::io::Error> for CommandError {
|
|||
CommandError::BrokenPipe
|
||||
} else {
|
||||
// TODO: Record the error as a chained cause
|
||||
CommandError::InternalError(format!("I/O error: {err}"))
|
||||
user_error(format!("I/O error: {err}"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,10 +146,10 @@ fn test_next_fails_on_branching_children_no_stdin() {
|
|||
test_env.jj_cmd_ok(&repo_path, &["co", "@--"]);
|
||||
|
||||
// Try to advance the working copy commit.
|
||||
let assert = test_env.jj_cmd(&repo_path, &["next"]).assert().code(255);
|
||||
let assert = test_env.jj_cmd(&repo_path, &["next"]).assert().code(1);
|
||||
let stderr = test_env.normalize_output(&get_stderr_string(&assert));
|
||||
insta::assert_snapshot!(stderr,@r###"
|
||||
Internal error: I/O error: Cannot prompt for input since the output is not connected to a terminal
|
||||
Error: I/O error: Cannot prompt for input since the output is not connected to a terminal
|
||||
"###);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue