Last change
on this file since 88 was 88, checked in by Bart Vastenhouw, 3 years ago |
Added python SimpleRunner GUI
|
File size:
1.2 KB
|
Line | |
---|
1 | from typing import Optional
|
---|
2 |
|
---|
3 | from geniusweb.actions.PartyId import PartyId
|
---|
4 |
|
---|
5 |
|
---|
6 | class ProtocolException (Exception) :
|
---|
7 | '''
|
---|
8 | thrown if a Party violates the protocols (that includes disconnecting).
|
---|
9 | '''
|
---|
10 |
|
---|
11 | def __init__(self, message:str, party:Optional[PartyId] , e:Optional[Exception]=None):
|
---|
12 | '''
|
---|
13 | ProtocolException is special, in that it does not auto-fill the
|
---|
14 | stacktrace. This is needed because usually a ProtocolException is caused
|
---|
15 | by a party doing a bad action. Creating a stacktrace pointing to the
|
---|
16 | class reporting the protocol exception (usually, the protocol handler)
|
---|
17 | makes no sense as the protocol handler is doing the correct job there.
|
---|
18 |
|
---|
19 |
|
---|
20 | @param message the error message
|
---|
21 | @param party offending/failing {@link PartyId}. In exceptional cases this can
|
---|
22 | be null, eg if it can not be determined which party
|
---|
23 | failed. Null should be avoided if possible at all.
|
---|
24 | @param e the cause of the error, none if no cause
|
---|
25 | '''
|
---|
26 | super().__init__(str(party) + ":" + message)
|
---|
27 | self.__cause__=e
|
---|
28 | self._party = party
|
---|
29 |
|
---|
30 |
|
---|
31 | def getParty(self) -> Optional[PartyId] :
|
---|
32 | '''
|
---|
33 | @return offending party, either the {@link PartyId} or a {@link PartyRef}
|
---|
34 | '''
|
---|
35 | return self._party;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.