RequestFailedException.java

// Copyright (c) ZeroC, Inc.

package com.zeroc.Ice;

/** The base class for the 3 NotExist exceptions. */
public abstract class RequestFailedException extends DispatchException {
    @Override
    public String ice_id() {
        return "::Ice::RequestFailedException";
    }

    /** The identity of the Ice Object to which the request was sent. */
    public final Identity id;

    /** The facet to which the request was sent. */
    public final String facet;

    /** The operation name of the request. */
    public final String operation;

    RequestFailedException(ReplyStatus replyStatus) {
        super(replyStatus.value());
        this.id = new Identity();
        this.facet = "";
        this.operation = "";
    }

    RequestFailedException(ReplyStatus replyStatus, Identity id, String facet, String operation) {
        super(replyStatus.value(), createMessage(replyStatus, id, facet, operation));
        this.id = id;
        this.facet = facet;
        this.operation = operation;
    }

    private static String createMessage(ReplyStatus replyStatus, Identity id, String facet, String operation) {
        return "Dispatch failed with " + replyStatus + " { id = '" + Util.identityToString(id) + "', facet = '" + facet
            + "', operation = '" + operation + "' }";
    }

    private static final long serialVersionUID = 4181164754424262091L;
}