chore: modify no_active_datanodes error msg (#41)
* chore: modify no_active_datanodes error msg * cr
This commit is contained in:
+7
-4
@@ -101,16 +101,19 @@ impl ResponseHeader {
|
|||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum ErrorCode {
|
pub enum ErrorCode {
|
||||||
NoActiveDatanodes = 1,
|
NotEnoughActiveDatanodes = 1,
|
||||||
NotLeader = 2,
|
NotLeader = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Error {
|
impl Error {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn no_active_datanodes() -> Self {
|
pub fn not_enough_active_datanodes(datanode_num: u32) -> Self {
|
||||||
Self {
|
Self {
|
||||||
code: ErrorCode::NoActiveDatanodes as i32,
|
code: ErrorCode::NotEnoughActiveDatanodes as i32,
|
||||||
err_msg: "No active datanodes".to_string(),
|
err_msg: format!(
|
||||||
|
"There are not enough active datanodes, the number is {}.",
|
||||||
|
datanode_num
|
||||||
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user