[#884] cli: Fix error message for undefined endpoint
All checks were successful
DCO action / DCO (pull_request) Successful in 1m36s
Vulncheck / Vulncheck (pull_request) Successful in 3m7s
Build / Build Components (1.20) (pull_request) Successful in 3m52s
Build / Build Components (1.21) (pull_request) Successful in 3m56s
Tests and linters / Lint (pull_request) Successful in 4m48s
Tests and linters / Staticcheck (pull_request) Successful in 4m55s
Tests and linters / Tests (1.21) (pull_request) Successful in 6m51s
Tests and linters / Tests (1.20) (pull_request) Successful in 8m27s
Tests and linters / Tests with -race (pull_request) Successful in 10m0s

Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
This commit is contained in:
Alexander Chuprov 2024-01-09 18:34:25 +03:00
parent d5d3d8badb
commit b19ba94556
2 changed files with 8 additions and 0 deletions

View file

@ -34,6 +34,10 @@ func GetSDKClientByFlag(cmd *cobra.Command, key *ecdsa.PrivateKey, endpointFlag
func getSDKClientByFlag(cmd *cobra.Command, key *ecdsa.PrivateKey, endpointFlag string) (*client.Client, error) {
var addr network.Address
if len(viper.GetString(endpointFlag)) == 0 {
return nil, fmt.Errorf("%s is not defined", endpointFlag)
}
err := addr.FromString(viper.GetString(endpointFlag))
if err != nil {
return nil, fmt.Errorf("%v: %w", errInvalidEndpoint, err)