From ac867f0ac839ee86da7cd1d84ebb7a2f0b7c6e73 Mon Sep 17 00:00:00 2001 From: Doug Fawley Date: Thu, 28 Jul 2022 23:30:53 +0000 Subject: [PATCH] log error --- dialoptions.go | 1 + server.go | 1 + test/end2end_test.go | 1 + 3 files changed, 3 insertions(+) diff --git a/dialoptions.go b/dialoptions.go index fbe14e7e2441..60403bc160ec 100644 --- a/dialoptions.go +++ b/dialoptions.go @@ -392,6 +392,7 @@ func WithDialer(f func(string, time.Duration) (net.Conn, error)) DialOption { func WithStatsHandler(h stats.Handler) DialOption { return newFuncDialOption(func(o *dialOptions) { if h == nil { + logger.Error("ignoring nil parameter in grpc.WithStatsHandler ClientOption") // Do not allow a nil stats handler, which would otherwise cause // panics. return diff --git a/server.go b/server.go index 5852976f8bae..2ad9da7bfccf 100644 --- a/server.go +++ b/server.go @@ -443,6 +443,7 @@ func InTapHandle(h tap.ServerInHandle) ServerOption { func StatsHandler(h stats.Handler) ServerOption { return newFuncServerOption(func(o *serverOptions) { if h == nil { + logger.Error("ignoring nil parameter in grpc.StatsHandler ServerOption") // Do not allow a nil stats handler, which would otherwise cause // panics. return diff --git a/test/end2end_test.go b/test/end2end_test.go index 15996d986cbf..de72b25c823c 100644 --- a/test/end2end_test.go +++ b/test/end2end_test.go @@ -8045,6 +8045,7 @@ func (s) TestServerClosesConn(t *testing.T) { // TestNilStatsHandler ensures we do not panic as a result of a nil stats // handler. func (s) TestNilStatsHandler(t *testing.T) { + grpctest.TLogger.ExpectErrorN("ignoring nil parameter", 2) ss := &stubserver.StubServer{ UnaryCallF: func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { return &testpb.SimpleResponse{}, nil