errors/grpc.go
func GRPCCodeToType(code codes.Code) Type {
	switch code {
	case codes.InvalidArgument:
		return InvalidArgument
	case codes.OutOfRange:
		return OutOfRange
	case codes.NotFound:
		return NotFound
	case codes.AlreadyExists:
		return AlreadyExists
	case codes.Unauthenticated:
		return Unauthorized
	case codes.PermissionDenied:
		return PermissionDenied
	case codes.DeadlineExceeded:
		return Timeout
	case codes.Unimplemented:
		return NotImplemented
	case codes.Unavailable:
		return TemporarilyUnavailable
	case codes.FailedPrecondition:
		return PermanentlyUnavailable
	case codes.Canceled:
		return Canceled
	case codes.ResourceExhausted:
		return ResourceExhausted
	case codes.Unknown:
		return Unknown
	}
	return Unknown
}
func GRPCCodeToType(code codes.Code) Type {
	switch code {
	case codes.InvalidArgument:
		return InvalidArgument
	case codes.OutOfRange:
		return OutOfRange
	case codes.NotFound:
		return NotFound
	case codes.AlreadyExists:
		return AlreadyExists
	case codes.Unauthenticated:
		return Unauthorized
	case codes.PermissionDenied:
		return PermissionDenied
	case codes.DeadlineExceeded:
		return Timeout
	case codes.Unimplemented:
		return NotImplemented
	case codes.Unavailable:
		return TemporarilyUnavailable
	case codes.FailedPrecondition:
		return PermanentlyUnavailable
	case codes.Canceled:
		return Canceled
	case codes.ResourceExhausted:
		return ResourceExhausted
	case codes.Unknown:
		return Unknown
	}
	return Unknown
}
// GRPCCodeToType converts the gRPC error code to an error type or returns the
// Unknown type if not possible.