package com.atlassian.bitbucket.scm.git.command.push;

import com.atlassian.bitbucket.i18n.KeyedMessage;
import com.atlassian.bitbucket.scm.git.GitException;

import javax.annotation.Nonnull;

import static com.google.common.base.Preconditions.checkNotNull;

/**
 * Indicates a non-forced push to a ref failed because it was not fast-forward.
 */
public class GitNonFastForwardUpdateRejectedException extends GitException {

    private final String rejectedRef;

    public GitNonFastForwardUpdateRejectedException(@Nonnull KeyedMessage keyedText, @Nonnull String rejectedRef) {
        super(keyedText);

        this.rejectedRef = checkNotNull(rejectedRef, "rejectedRef");
    }

    @Nonnull
    public String getRejectedRef() {
        return rejectedRef;
    }
}
