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

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

import javax.annotation.Nonnull;

public class EmptySquashMergeException extends MergeException {

    public EmptySquashMergeException() {
        super("The merge failed because the squashed commit would be empty");
    }

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