--- a/rust/rhg/src/error.rs Mon Jun 07 17:19:46 2021 +0530
+++ b/rust/rhg/src/error.rs Mon Jun 07 17:27:49 2021 +0530
@@ -1,10 +1,10 @@
-use crate::exitcode;
use crate::ui::utf8_to_local;
use crate::ui::UiError;
use crate::NoRepoInCwdError;
use format_bytes::format_bytes;
use hg::config::{ConfigError, ConfigParseError, ConfigValueParseError};
use hg::errors::HgError;
+use hg::exit_codes;
use hg::repo::RepoError;
use hg::revlog::revlog::RevlogError;
use hg::utils::files::get_bytes_from_path;
@@ -17,7 +17,7 @@
/// Exit with an error message and "standard" failure exit code.
Abort {
message: Vec<u8>,
- detailed_exit_code: exitcode::ExitCode,
+ detailed_exit_code: exit_codes::ExitCode,
},
/// Exit with a failure exit code but no message.
@@ -32,12 +32,12 @@
impl CommandError {
pub fn abort(message: impl AsRef<str>) -> Self {
- CommandError::abort_with_exit_code(message, exitcode::ABORT)
+ CommandError::abort_with_exit_code(message, exit_codes::ABORT)
}
pub fn abort_with_exit_code(
message: impl AsRef<str>,
- detailed_exit_code: exitcode::ExitCode,
+ detailed_exit_code: exit_codes::ExitCode,
) -> Self {
CommandError::Abort {
// TODO: bytes-based (instead of Unicode-based) formatting
@@ -78,7 +78,7 @@
fn from(error: ConfigValueParseError) -> Self {
CommandError::abort_with_exit_code(
error.to_string(),
- exitcode::CONFIG_ERROR_ABORT,
+ exit_codes::CONFIG_ERROR_ABORT,
)
}
}
@@ -100,7 +100,7 @@
b"abort: repository {} not found",
get_bytes_from_path(at)
),
- detailed_exit_code: exitcode::ABORT,
+ detailed_exit_code: exit_codes::ABORT,
},
RepoError::ConfigParseError(error) => error.into(),
RepoError::Other(error) => error.into(),
@@ -116,7 +116,7 @@
b"abort: no repository found in '{}' (.hg not found)!",
get_bytes_from_path(cwd)
),
- detailed_exit_code: exitcode::ABORT,
+ detailed_exit_code: exit_codes::ABORT,
}
}
}
@@ -149,7 +149,7 @@
line_message,
message
),
- detailed_exit_code: exitcode::CONFIG_ERROR_ABORT,
+ detailed_exit_code: exit_codes::CONFIG_ERROR_ABORT,
}
}
}