func ToGRPC(err error) error {
	if err == nil {
		return nil
	}
	if isGRPCError(err) {
		return err
	}
	switch {
	case IsInvalidArgument(err):
		return status.Errorf(codes.InvalidArgument, err.Error())
	case IsNotFound(err):
		return status.Errorf(codes.NotFound, err.Error())
	case IsAlreadyExists(err):
		return status.Errorf(codes.AlreadyExists, err.Error())
	case IsFailedPrecondition(err):
		return status.Errorf(codes.FailedPrecondition, err.Error())
	case IsUnavailable(err):
		return status.Errorf(codes.Unavailable, err.Error())
	case IsNotImplemented(err):
		return status.Errorf(codes.Unimplemented, err.Error())
	}
	return err
}
ToGRPC will attempt to map the backend containerd error into a grpc error,
using the original error message as a description.

Further information may be extracted from certain errors depending on their
type.

If the error is unmapped, the original error will be returned to be handled
by the regular grpc error handling stack.
package errdefs
import (
	"strings"
	"github.com/pkg/errors"
	"google.golang.org/grpc/codes"
	"google.golang.org/grpc/status"
)