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

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

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import static io.grpc.Status.INTERNAL;

public class SetMetadataFailedException extends AbstractGitException {

    public SetMetadataFailedException(@Nullable Throwable cause) {
        super("Failed to set metadata", cause, INTERNAL);
    }

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