From 9a01e1fdb3d5c3c8b7c323deb95f9781a7e636e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Tue, 6 Jan 2026 10:29:45 +0800 Subject: [PATCH] fix(region): show pretty error (#24022) --- cmd/climc/shell/compute/workers.go | 2 +- pkg/mcclient/modulebase/base.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/climc/shell/compute/workers.go b/cmd/climc/shell/compute/workers.go index 6ff4e521e9..768b0bdbf7 100644 --- a/cmd/climc/shell/compute/workers.go +++ b/cmd/climc/shell/compute/workers.go @@ -23,7 +23,7 @@ import ( func init() { type WorkerListOptions struct { - ServiceType string `choices:"image|cloudid|cloudevent|devtool|ansible|identity|notify|log|compute|compute_v2"` + ServiceType string `choices:"image|cloudid|cloudevent|devtool|ansible|identity|notify|log|compute|compute_v2|meter|suggestion|cloudmon|cloudproxy|dns|monitor|scheduler|vpcagent|webconsole|yunionconf|bastionhost|extdb|yunionapi|report"` } R(&WorkerListOptions{}, "worker-list", "List workers", func(s *mcclient.ClientSession, args *WorkerListOptions) error { result, err := modules.Workers.List(s, jsonutils.Marshal(args)) diff --git a/pkg/mcclient/modulebase/base.go b/pkg/mcclient/modulebase/base.go index c5133f308c..6c765e694b 100644 --- a/pkg/mcclient/modulebase/base.go +++ b/pkg/mcclient/modulebase/base.go @@ -103,7 +103,7 @@ func (this *BaseManager) jsonRequest(session *mcclient.ClientSession, method, this.versionedURL(path), header, body) if err != nil { - if e, ok := err.(*httputils.JSONClientError); ok { + if e, ok := err.(*httputils.JSONClientError); ok && strings.Contains(e.Details, e.Request.Url) { switch e.Class { case errors.ErrConnectRefused.Error(): return nil, nil, httperrors.NewServiceAbnormalError("%s service is abnormal, please check service status", this.serviceType)