From 4e6161351a3f42a04bd1b13d395edb4a1690b77c Mon Sep 17 00:00:00 2001 From: fys <40801205+Fengys123@users.noreply.github.com> Date: Mon, 29 May 2023 14:21:57 +0800 Subject: [PATCH] chore: modify no_active_datanodes error msg (#41) * chore: modify no_active_datanodes error msg * cr --- src/v1/meta.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/v1/meta.rs b/src/v1/meta.rs index c90a567..5cee483 100644 --- a/src/v1/meta.rs +++ b/src/v1/meta.rs @@ -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 + ), } }