package geniusweb.protocol; import geniusweb.actions.PartyId; import geniusweb.references.PartyRef; /** * thrown if a Party violates the protocols (that includes disconnecting). */ public class ProtocolException extends Exception { private static final long serialVersionUID = 4618901784366523980L; private PartyId party; // the failing party /** * @param message the error message * @param party offending party, either the {@link PartyId} or a * {@link PartyRef} */ public ProtocolException(String message, PartyId party) { this(message, party, null); } /** * ProtocolException is special, in that it does not auto-fill the * stacktrace. This is needed because usually a ProtocolException is caused * by a party doing a bad action. Creating a stacktrace pointing to the * class reporting the protocol exception (usually, the protocol handler) * makes no sense as the protocol handler is doing the correct job there. * * * @param message the error message * @param party offending {@link PartyId} * @param e the cause of the error */ public ProtocolException(String message, PartyId party, Throwable e) { super(party + ":" + message, e, true, false); this.party = party; } /** * * @return offending party, either the {@link PartyId} or a {@link PartyRef} */ public PartyId getParty() { return party; } }