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

Function mapRecvMsgError

internal/transport/handler_server.go:493–506  ·  view source on GitHub ↗

mapRecvMsgError returns the non-nil err into the appropriate error value as expected by callers of *grpc.parser.recvMsg. In particular, in can only be: - io.EOF - io.ErrUnexpectedEOF - of type transport.ConnectionError - an error from the status package

(err error)

Source from the content-addressed store, hash-verified

491// - of type transport.ConnectionError
492// - an error from the status package
493func mapRecvMsgError(err error) error {
494 if err == io.EOF || err == io.ErrUnexpectedEOF {
495 return err
496 }
497 if se, ok := err.(http2.StreamError); ok {
498 if code, ok := http2ErrConvTab[se.Code]; ok {
499 return status.Error(code, se.Error())
500 }
501 }
502 if strings.Contains(err.Error(), "body closed by handler") {
503 return status.Error(codes.Canceled, err.Error())
504 }
505 return connectionErrorf(true, err, "%s", err.Error())
506}

Callers 1

HandleStreamsMethod · 0.85

Calls 3

ErrorFunction · 0.92
connectionErrorfFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected