MCPcopy
hub / github.com/grpc/grpc-go / ContextErr

Function ContextErr

internal/transport/transport.go:768–776  ·  view source on GitHub ↗

ContextErr converts the error from context package into a status error.

(err error)

Source from the content-addressed store, hash-verified

766
767// ContextErr converts the error from context package into a status error.
768func ContextErr(err error) error {
769 switch err {
770 case context.DeadlineExceeded:
771 return status.Error(codes.DeadlineExceeded, err.Error())
772 case context.Canceled:
773 return status.Error(codes.Canceled, err.Error())
774 }
775 return status.Errorf(codes.Internal, "Unexpected error from context packet: %v", err)
776}

Callers 8

TestContextErrMethod · 0.85
waitOnHeaderMethod · 0.85
readMessageHeaderMethod · 0.85
readMethod · 0.85
readClientMethod · 0.85
streamContextErrMethod · 0.85
NewStreamMethod · 0.85

Calls 3

ErrorFunction · 0.92
ErrorfFunction · 0.92
ErrorMethod · 0.65

Tested by 1

TestContextErrMethod · 0.68