MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / TaskErrorWrapper

Function TaskErrorWrapper

service/error.go:139–155  ·  view source on GitHub ↗
(err error, code string, statusCode int)

Source from the content-addressed store, hash-verified

137}
138
139func TaskErrorWrapper(err error, code string, statusCode int) *dto.TaskError {
140 text := err.Error()
141 lowerText := strings.ToLower(text)
142 if strings.Contains(lowerText, "post") || strings.Contains(lowerText, "dial") || strings.Contains(lowerText, "http") {
143 common.SysLog(fmt.Sprintf("error: %s", text))
144 text = "请求上游地址失败"
145 }
146 //避免暴露内部错误
147 taskError := &dto.TaskError{
148 Code: code,
149 Message: text,
150 StatusCode: statusCode,
151 Error: err,
152 }
153
154 return taskError
155}

Callers 9

RelayTaskSubmitFunction · 0.92
RelayTaskFetchFunction · 0.92
sunoFetchRespBodyBuilderFunction · 0.92
DoResponseMethod · 0.92
DoResponseMethod · 0.92
DoResponseMethod · 0.92
TaskErrorWrapperLocalFunction · 0.85

Calls 3

SysLogFunction · 0.92
ErrorMethod · 0.80
ContainsMethod · 0.80

Tested by

no test coverage detected