Behaviour Change: transport errors should be coded Unavailable instead of internal. (#1307)
This commit is contained in:
Родитель
1ab4adf22d
Коммит
a3592bda22
2
go16.go
2
go16.go
|
@ -56,7 +56,7 @@ func toRPCErr(err error) error {
|
|||
case transport.StreamError:
|
||||
return status.Error(e.Code, e.Desc)
|
||||
case transport.ConnectionError:
|
||||
return status.Error(codes.Internal, e.Desc)
|
||||
return status.Error(codes.Unavailable, e.Desc)
|
||||
default:
|
||||
switch err {
|
||||
case context.DeadlineExceeded:
|
||||
|
|
2
go17.go
2
go17.go
|
@ -56,7 +56,7 @@ func toRPCErr(err error) error {
|
|||
case transport.StreamError:
|
||||
return status.Error(e.Code, e.Desc)
|
||||
case transport.ConnectionError:
|
||||
return status.Error(codes.Internal, e.Desc)
|
||||
return status.Error(codes.Unavailable, e.Desc)
|
||||
default:
|
||||
switch err {
|
||||
case context.DeadlineExceeded, netctx.DeadlineExceeded:
|
||||
|
|
|
@ -148,7 +148,7 @@ func TestToRPCErr(t *testing.T) {
|
|||
errOut error
|
||||
}{
|
||||
{transport.StreamError{Code: codes.Unknown, Desc: ""}, status.Error(codes.Unknown, "")},
|
||||
{transport.ErrConnClosing, status.Error(codes.Internal, transport.ErrConnClosing.Desc)},
|
||||
{transport.ErrConnClosing, status.Error(codes.Unavailable, transport.ErrConnClosing.Desc)},
|
||||
} {
|
||||
err := toRPCErr(test.errIn)
|
||||
if _, ok := status.FromError(err); !ok {
|
||||
|
|
Загрузка…
Ссылка в новой задаче