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

Last change on this file since 16 was 4, checked in by bart, 5 years ago

Faster example parties

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