source: protocol/src/main/java/geniusweb/protocol/ProtocolException.java

Last change on this file was 52, checked in by ruud, 14 months ago

Fixed small issues in domaineditor.

File size: 1.8 KB
Line 
1package geniusweb.protocol;
2
3import geniusweb.actions.PartyId;
4import geniusweb.references.PartyRef;
5
6/**
7 * thrown if a Party violates the protocols (that includes disconnecting).
8 */
9public class ProtocolException extends Exception {
10 private static final long serialVersionUID = 4618901784366523980L;
11 private PartyId party; // the failing party
12
13 /**
14 * @param message the error message
15 * @param party offending party, either the {@link PartyId} or a
16 * {@link PartyRef}. In exceptional cases this can be null,
17 * eg if it can not be determined which party failed. Null
18 * should be avoided if possible at all.
19 */
20 public ProtocolException(String message, PartyId party) {
21 this(message, party, null);
22 }
23
24 /**
25 * ProtocolException is special, in that it does not auto-fill the
26 * stacktrace. This is needed because usually a ProtocolException is caused
27 * by a party doing a bad action. Creating a stacktrace pointing to the
28 * class reporting the protocol exception (usually, the protocol handler)
29 * makes no sense as the protocol handler is doing the correct job there.
30 *
31 *
32 * @param message the error message
33 * @param party offending {@link PartyId}. In exceptional cases this can
34 * be null, eg if it can not be determined which party
35 * failed. Null should be avoided if possible at all.
36 * @param e the cause of the error
37 */
38 public ProtocolException(String message, PartyId party, Throwable e) {
39 super(party + ":" + message, e, true, false);
40 this.party = party;
41 }
42
43 /**
44 *
45 * @return offending party, either the {@link PartyId} or a
46 * {@link PartyRef}. In exceptional cases this can be null.
47 */
48 public PartyId getParty() {
49 return party;
50 }
51
52}
Note: See TracBrowser for help on using the repository browser.