From 3bfe57018a65d309d2bcfcf073b45e54a185e810 Mon Sep 17 00:00:00 2001 From: Menghan Li Date: Fri, 21 Jan 2022 11:57:12 -0800 Subject: [PATCH] [ctx_error_unknown_status] doc --- interceptor.go | 9 ++++++--- stream.go | 10 ++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/interceptor.go b/interceptor.go index 668e0adcf0a9..bb96ef57be89 100644 --- a/interceptor.go +++ b/interceptor.go @@ -72,9 +72,12 @@ type UnaryServerInfo struct { } // UnaryHandler defines the handler invoked by UnaryServerInterceptor to complete the normal -// execution of a unary RPC. If a UnaryHandler returns an error, it should be produced by the -// status package, or else gRPC will use codes.Unknown as the status code and err.Error() as -// the status message of the RPC. +// execution of a unary RPC. +// +// If a UnaryHandler returns an error, it should either be produced by the +// status package, or be one of the context errors. Otherwise, gRPC will use +// codes.Unknown as the status code and err.Error() as the status message of the +// RPC. type UnaryHandler func(ctx context.Context, req interface{}) (interface{}, error) // UnaryServerInterceptor provides a hook to intercept the execution of a unary RPC on the server. info diff --git a/stream.go b/stream.go index 625d47b34e59..8cdd652e037b 100644 --- a/stream.go +++ b/stream.go @@ -46,10 +46,12 @@ import ( ) // StreamHandler defines the handler called by gRPC server to complete the -// execution of a streaming RPC. If a StreamHandler returns an error, it -// should be produced by the status package, or else gRPC will use -// codes.Unknown as the status code and err.Error() as the status message -// of the RPC. +// execution of a streaming RPC. +// +// If a StreamHandler returns an error, it should either be produced by the +// status package, or be one of the context errors. Otherwise, gRPC will use +// codes.Unknown as the status code and err.Error() as the status message of the +// RPC. type StreamHandler func(srv interface{}, stream ServerStream) error // StreamDesc represents a streaming RPC service's method specification. Used