package com.atlassian.bitbucket.mesh.git.exception;

import com.atlassian.bitbucket.mesh.rpc.v1.RpcGitError;
import com.atlassian.bitbucket.mesh.rpc.v1.RpcInvalidFollowPathspec;

import javax.annotation.Nonnull;

import static io.grpc.Status.INVALID_ARGUMENT;

public class InvalidFollowPathspecException extends AbstractGitException {

    public InvalidFollowPathspecException() {
        super("Invalid pathspec supplied: --follow requires exactly one pathspec", INVALID_ARGUMENT);
    }

    @Nonnull
    @Override
    public RpcGitError toError() {
        return RpcGitError.newBuilder()
                .setInvalidFollowPathspec(RpcInvalidFollowPathspec.getDefaultInstance())
                .build();
    }
}
