MCPcopy
hub / github.com/lima-vm/lima / Error

Method Error

pkg/httpclientutil/httpclientutil.go:99–107  ·  view source on GitHub ↗

Error implements error. If e.Body is a marshalled string of httputil.ErrorJSON, Error returns ErrorJSON.Message . Otherwise Error returns a human-readable string that contains e.StatusCode and e.Body.

()

Source from the content-addressed store, hash-verified

97// If e.Body is a marshalled string of httputil.ErrorJSON, Error returns ErrorJSON.Message .
98// Otherwise Error returns a human-readable string that contains e.StatusCode and e.Body.
99func (e *HTTPStatusError) Error() string {
100 if e.Body != "" && len(e.Body) < HTTPStatusErrorBodyMaxLength {
101 var ej httputil.ErrorJSON
102 if json.Unmarshal([]byte(e.Body), &ej) == nil {
103 return ej.Message
104 }
105 }
106 return fmt.Sprintf("unexpected HTTP status %s, body=%q", http.StatusText(e.StatusCode), e.Body)
107}
108
109func Successful(resp *http.Response) error {
110 if resp == nil {

Callers 15

listenQEMUFunction · 0.45
listenFDFunction · 0.45
muxWithExtensionFunction · 0.45
StopFunction · 0.45
forwardTCPMethod · 0.45
HandleUDPConnectionFunction · 0.45
TestGetDefaultBlockListFunction · 0.45
TestValidateEmptyFunction · 0.45
TestValidateDigestFunction · 0.45
TestValidateProbesFunction · 0.45

Calls 1

UnmarshalMethod · 0.80

Tested by 15

TestGetDefaultBlockListFunction · 0.36
TestValidateEmptyFunction · 0.36
TestValidateDigestFunction · 0.36
TestValidateProbesFunction · 0.36
TestValidateParamIsUsedFunction · 0.36