chore: modify not_enough_available_datanodes error msg (#42)

This commit is contained in:
fys
2023-05-30 12:29:33 +08:00
committed by GitHub
parent ff0a47b646
commit 44c5adf349
+4 -5
View File
@@ -101,18 +101,17 @@ impl ResponseHeader {
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ErrorCode { pub enum ErrorCode {
NotEnoughActiveDatanodes = 1, NotEnoughAvailableDatanodes = 1,
NotLeader = 2, NotLeader = 2,
} }
impl Error { impl Error {
#[inline] #[inline]
pub fn not_enough_active_datanodes(datanode_num: u32) -> Self { pub fn not_enough_available_datanodes(expected: usize, actual: usize) -> Self {
Self { Self {
code: ErrorCode::NotEnoughActiveDatanodes as i32, code: ErrorCode::NotEnoughAvailableDatanodes as i32,
err_msg: format!( err_msg: format!(
"There are not enough active datanodes, the number is {}.", "There are not enough active datanodes, expected: {expected}, actual: {actual}."
datanode_num
), ),
} }
} }