MCPcopy
hub / github.com/mudler/LocalAI / Is

Method Is

pkg/mcp/localaitools/httpapi/client.go:71–79  ·  view source on GitHub ↗

Is supports errors.Is(*HTTPError, ErrHTTPNotFound). The 500-with-text branch is a transitional fallback for /models/jobs/:uuid which today returns a 500 carrying "could not find any status for ID" instead of a proper 404. Drop the branch when the server is fixed.

(target error)

Source from the content-addressed store, hash-verified

69// returns a 500 carrying "could not find any status for ID" instead of a
70// proper 404. Drop the branch when the server is fixed.
71func (e *HTTPError) Is(target error) bool {
72 if target != ErrHTTPNotFound {
73 return false
74 }
75 if e.StatusCode == http.StatusNotFound {
76 return true
77 }
78 return e.StatusCode == http.StatusInternalServerError && strings.Contains(e.Body, "could not find")
79}
80
81// ---- HTTP helpers ----
82

Callers 15

ForwardMethod · 0.45
uri_test.goFile · 0.45
cancel_test.goFile · 0.45
removePartialFileFunction · 0.45
AudioTransformStreamMethod · 0.45
AudioToAudioStreamMethod · 0.45
ForwardMethod · 0.45

Calls 1

ContainsMethod · 0.80

Tested by 2