Skip to content

Commit c1cd91e

Browse files
authored
fix(region): show pretty error (#24021)
1 parent 27500ca commit c1cd91e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

cmd/climc/shell/compute/workers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323

2424
func init() {
2525
type WorkerListOptions struct {
26-
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"`
26+
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"`
2727
}
2828
R(&WorkerListOptions{}, "worker-list", "List workers", func(s *mcclient.ClientSession, args *WorkerListOptions) error {
2929
result, err := modules.Workers.List(s, jsonutils.Marshal(args))

pkg/mcclient/modulebase/base.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func (this *BaseManager) jsonRequest(session *mcclient.ClientSession,
103103
method, this.versionedURL(path),
104104
header, body)
105105
if err != nil {
106-
if e, ok := err.(*httputils.JSONClientError); ok {
106+
if e, ok := err.(*httputils.JSONClientError); ok && strings.Contains(e.Details, e.Request.Url) {
107107
switch e.Class {
108108
case errors.ErrConnectRefused.Error():
109109
return nil, nil, httperrors.NewServiceAbnormalError("%s service is abnormal, please check service status", this.serviceType)

0 commit comments

Comments
 (0)