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

import com.atlassian.bitbucket.mesh.rpc.v1.RpcGitError;
import com.atlassian.bitbucket.mesh.rpc.v1.RpcLfsStorageFailed;
import io.grpc.Status;

import javax.annotation.Nonnull;

/**
 * An internal error occurred during an LFS RPC
 */
public class LfsStorageException extends AbstractGitException {

    public LfsStorageException(Exception cause) {
        super("LFS storage operation failed", cause, Status.INTERNAL);
    }

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