chore: modify no_active_datanodes error msg (#41)

* chore: modify no_active_datanodes error msg

* cr
This commit is contained in:
fys
2023-05-29 14:21:57 +08:00
committed by GitHub
parent 5838259244
commit 4e6161351a
+7 -4
View File
@@ -101,16 +101,19 @@ impl ResponseHeader {
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ErrorCode {
NoActiveDatanodes = 1,
NotEnoughActiveDatanodes = 1,
NotLeader = 2,
}
impl Error {
#[inline]
pub fn no_active_datanodes() -> Self {
pub fn not_enough_active_datanodes(datanode_num: u32) -> Self {
Self {
code: ErrorCode::NoActiveDatanodes as i32,
err_msg: "No active datanodes".to_string(),
code: ErrorCode::NotEnoughActiveDatanodes as i32,
err_msg: format!(
"There are not enough active datanodes, the number is {}.",
datanode_num
),
}
}