mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
fix(region): show pretty error (#24021)
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user