| @@ -9,9 +9,9 @@ import ( | |||||
| type NodeEnvType string | type NodeEnvType string | ||||
| const ( | const ( | ||||
| EnvUnknown NodeEnvType = "" | |||||
| EnvDriver NodeEnvType = "Driver" | |||||
| EnvWorker NodeEnvType = "Worker" | |||||
| EnvAny NodeEnvType = "" | |||||
| EnvDriver NodeEnvType = "Driver" | |||||
| EnvWorker NodeEnvType = "Worker" | |||||
| ) | ) | ||||
| type NodeEnv struct { | type NodeEnv struct { | ||||
| @@ -21,7 +21,7 @@ type NodeEnv struct { | |||||
| } | } | ||||
| func (e *NodeEnv) ToEnvUnknown(pinned bool) { | func (e *NodeEnv) ToEnvUnknown(pinned bool) { | ||||
| e.Type = EnvUnknown | |||||
| e.Type = EnvAny | |||||
| e.Worker = nil | e.Worker = nil | ||||
| e.Pinned = pinned | e.Pinned = pinned | ||||
| } | } | ||||
| @@ -199,3 +199,11 @@ func ParseCodeDataJSONResponse[T any](resp *http.Response, ret T) error { | |||||
| return fmt.Errorf("unknow response content type: %s, status: %d, body[:200]: %s", contType, resp.StatusCode, strCont) | return fmt.Errorf("unknow response content type: %s, status: %d, body[:200]: %s", contType, resp.StatusCode, strCont) | ||||
| } | } | ||||
| func IsErrorCode(err error, code string) bool { | |||||
| if e, ok := err.(*CodeMessageError); ok { | |||||
| return e.Code == code | |||||
| } | |||||
| return false | |||||
| } | |||||