fix(region): show pretty error (#24021)

This commit is contained in:
屈轩
2026-01-06 10:29:39 +08:00
committed by GitHub
parent 27500ca14e
commit c1cd91e01c
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ import (
func init() {
type WorkerListOptions struct {
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"`
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))
+1 -1
View File
@@ -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)