MCPcopy
hub / github.com/connectrpc/connect-go / grpcStatusForError

Function grpcStatusForError

protocol_grpc.go:870–881  ·  view source on GitHub ↗
(err error)

Source from the content-addressed store, hash-verified

868}
869
870func grpcStatusForError(err error) *statusv1.Status {
871 status := &statusv1.Status{
872 Code: int32(CodeUnknown),
873 Message: err.Error(),
874 }
875 if connectErr, ok := asError(err); ok {
876 status.Code = int32(connectErr.Code()) //nolint:gosec // No information loss
877 status.Message = connectErr.Message()
878 status.Details = connectErr.detailsAsAny()
879 }
880 return status
881}
882
883// grpcPercentEncode follows RFC 3986 Section 2.1 and the gRPC HTTP/2 spec.
884// It's a variant of URL-encoding with fewer reserved characters. It's intended

Callers 1

grpcErrorToTrailerFunction · 0.85

Calls 5

asErrorFunction · 0.85
ErrorMethod · 0.80
CodeMethod · 0.80
MessageMethod · 0.80
detailsAsAnyMethod · 0.80

Tested by

no test coverage detected