Errors: context cancelled or context deadline exceeded are exposed as codes.Canceled, codes.DeadlineExceeded instead of 'codes.Unknown'

This commit is contained in:
Piotr Tabor
2021-04-22 12:57:23 +02:00
parent cc52d994b7
commit 9a4b2bdccc
4 changed files with 10 additions and 1 deletions

View File

@@ -83,6 +83,10 @@ var toGRPCErrorMap = map[error]error{
auth.ErrAuthNotEnabled: rpctypes.ErrGRPCAuthNotEnabled,
auth.ErrInvalidAuthToken: rpctypes.ErrGRPCInvalidAuthToken,
auth.ErrInvalidAuthMgmt: rpctypes.ErrGRPCInvalidAuthMgmt,
// In sync with status.FromContextError
context.Canceled: rpctypes.ErrGRPCCanceled,
context.DeadlineExceeded: rpctypes.ErrGRPCDeadlineExceeded,
}
func togRPCError(err error) error {