You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kvrocks.apache.org by hu...@apache.org on 2024/08/21 08:22:28 UTC

(kvrocks-controller) branch unstable updated: Fix client list command didn't handle API response error correctly (#199)

This is an automated email from the ASF dual-hosted git repository.

hulk pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks-controller.git


The following commit(s) were added to refs/heads/unstable by this push:
     new e87590f  Fix client list command didn't handle API response error correctly (#199)
e87590f is described below

commit e87590f68aa6f480ea941185f7c88026526b5e0e
Author: Ninuxer <31...@users.noreply.github.com>
AuthorDate: Wed Aug 21 16:22:24 2024 +0800

    Fix client list command didn't handle API response error correctly (#199)
---
 cmd/client/command/list.go | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/cmd/client/command/list.go b/cmd/client/command/list.go
index e7f628d..41626b4 100644
--- a/cmd/client/command/list.go
+++ b/cmd/client/command/list.go
@@ -86,6 +86,9 @@ func listNamespace(cli *client) error {
 	if err != nil {
 		return err
 	}
+	if rsp.IsError() {
+		return unmarshalError(rsp.Body())
+	}
 
 	var result struct {
 		Namespaces []string `json:"namespaces"`
@@ -110,6 +113,9 @@ func listClusters(cli *client) error {
 	if err != nil {
 		return err
 	}
+	if rsp.IsError() {
+		return unmarshalError(rsp.Body())
+	}
 
 	var result struct {
 		Clusters []string `json:"clusters"`