MCPcopy
hub / github.com/grafana/dskit / Errorf

Function Errorf

httpgrpc/httpgrpc.go:122–124  ·  view source on GitHub ↗

Errorf returns a HTTP gRPC error that is correctly forwarded over gRPC, and can eventually be converted back to a HTTP response with HTTPResponseFromError.

(code int, tmpl string, args ...interface{})

Source from the content-addressed store, hash-verified

120// gRPC, and can eventually be converted back to a HTTP response with
121// HTTPResponseFromError.
122func Errorf(code int, tmpl string, args ...interface{}) error {
123 return Error(code, fmt.Sprintf(tmpl, args...))
124}
125
126// ErrorFromHTTPResponse converts an HTTP response into a grpc error, and uses HTTP response body as an error message.
127// Note that if HTTP response body contains non-utf8 string, then returned error cannot be marshalled by protobuf.

Callers 3

TestBatchTracker_RecordFunction · 0.92
TestDoBatch_QuorumErrorFunction · 0.92
FailWithHTTPErrorMethod · 0.92

Calls 1

ErrorFunction · 0.85

Tested by 3

TestBatchTracker_RecordFunction · 0.74
TestDoBatch_QuorumErrorFunction · 0.74
FailWithHTTPErrorMethod · 0.74