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

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

import javax.annotation.Nonnull;

public class RebaseConflictedException extends MergeException {

    public RebaseConflictedException() {
        super("The rebase could not be completed due to file conflicts");
    }

    @Nonnull
    @Override
    public RpcGitError toError() {
        return RpcGitError.newBuilder()
                .setRebaseConflicted(RpcRebaseConflicted.newBuilder()
                        .setFromCommitId(fromCommitId))
                .build();
    }
}
