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)
| 491 | // - of type transport.ConnectionError |
| 492 | // - an error from the status package |
| 493 | func 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 | } |
no test coverage detected