Skip to content

Commit bcd1370

Browse files
committed
debug connection options
1 parent eae0620 commit bcd1370

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/main/java/bwapi/BWClient.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ public BWClient(final BWEventListener eventListener) {
1414
this(eventListener, false);
1515
}
1616

17+
/**
18+
* @param debugConnection set to `true` for more explicit error messages (might spam the terminal).
19+
* `false` by default
20+
*/
1721
public BWClient(final BWEventListener eventListener, final boolean debugConnection) {
1822
Objects.requireNonNull(eventListener);
1923
this.debugConnection = debugConnection;

src/main/java/bwapi/Client.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void reconnect(){
9595
void disconnect() {
9696
if (debugConnection) {
9797
System.err.print("Disconnect called by: ");
98-
System.err.println(Thread.currentThread().getStackTrace()[2].getMethodName());
98+
System.err.println(Thread.currentThread().getStackTrace()[2]);
9999
}
100100
if (!connected) {
101101
return;
@@ -134,9 +134,6 @@ boolean connect() {
134134
}
135135
catch (Exception e) {
136136
System.err.println("Game table mapping not found.");
137-
if (debugConnection) {
138-
e.printStackTrace();
139-
}
140137
return false;
141138
}
142139

0 commit comments

Comments
 (0)