From 29708b78d705958067a6f0d25b4e63572bf7e93d Mon Sep 17 00:00:00 2001 From: Aleksey Savchuk Date: Wed, 23 Oct 2024 15:37:50 +0300 Subject: [PATCH] [#1442] cli/tree: Enchance error message if `rpc-endpoint` isn't defined Signed-off-by: Aleksey Savchuk --- cmd/frostfs-cli/modules/tree/client.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/frostfs-cli/modules/tree/client.go b/cmd/frostfs-cli/modules/tree/client.go index 6891e711c..a70624ac8 100644 --- a/cmd/frostfs-cli/modules/tree/client.go +++ b/cmd/frostfs-cli/modules/tree/client.go @@ -2,6 +2,7 @@ package tree import ( "context" + "fmt" "strings" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/common" @@ -20,7 +21,13 @@ import ( // after making Tree API public. func _client() (tree.TreeServiceClient, error) { var netAddr network.Address - err := netAddr.FromString(viper.GetString(commonflags.RPC)) + + rpcEndpoint := viper.GetString(commonflags.RPC) + if rpcEndpoint == "" { + return nil, fmt.Errorf("%s is not defined", commonflags.RPC) + } + + err := netAddr.FromString(rpcEndpoint) if err != nil { return nil, err }