MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / homeModelsErrorMessage

Function homeModelsErrorMessage

internal/api/server.go:1315–1334  ·  view source on GitHub ↗
(raw []byte)

Source from the content-addressed store, hash-verified

1313}
1314
1315func homeModelsErrorMessage(raw []byte) string {
1316 top, ok := unmarshalHomeModelsTopLevel(raw)
1317 if !ok {
1318 return "home models request failed"
1319 }
1320 rawErr, exists := top["error"]
1321 if !exists {
1322 return "home models request failed"
1323 }
1324 var errObj struct {
1325 Message string `json:"message"`
1326 }
1327 if errUnmarshal := json.Unmarshal(rawErr, &errObj); errUnmarshal != nil {
1328 return "home models request failed"
1329 }
1330 if msg := strings.TrimSpace(errObj.Message); msg != "" {
1331 return msg
1332 }
1333 return "home models request failed"
1334}
1335
1336func unmarshalHomeModelsTopLevel(raw []byte) (map[string]json.RawMessage, bool) {
1337 if len(raw) == 0 {

Callers 2

loadHomeModelEntriesMethod · 0.85

Calls 1

Tested by 1