Skip to content

Commit 21670d3

Browse files
Added handler for onError, and fixed logging messages that were using String.format.
1 parent 4bfd6ce commit 21670d3

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/main/java/net/twasi/obsremotejava/OBSCommunicator.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,14 @@ public void await() throws InterruptedException {
146146
this.closeLatch.await();
147147
}
148148

149+
@OnWebSocketError
150+
public void onError(Session session, Throwable throwable) {
151+
152+
}
153+
149154
@OnWebSocketClose
150155
public void onClose(int statusCode, String reason) {
151-
log.info("Connection closed: %d - %s%n", statusCode, reason);
156+
log.info(String.format("Connection closed: %d - %s%n", statusCode, reason));
152157
this.closeLatch.countDown(); // trigger latch
153158
try {
154159
this.onDisconnect.run(null);
@@ -224,7 +229,7 @@ private void processIncomingResponse(ResponseBase responseBase, Class type) {
224229
switch (type.getSimpleName()) {
225230
case "GetVersionResponse":
226231
versionInfo = (GetVersionResponse) responseBase;
227-
log.info("Connected to OBS. Websocket Version: %s, Studio Version: %s\n", versionInfo.getObsWebsocketVersion(), versionInfo.getObsStudioVersion());
232+
log.info(String.format("Connected to OBS. Websocket Version: %s, Studio Version: %s\n", versionInfo.getObsWebsocketVersion(), versionInfo.getObsStudioVersion()));
228233
session.getRemote().sendStringByFuture(new Gson().toJson(new GetAuthRequiredRequest(this)));
229234
break;
230235

src/main/java/net/twasi/obsremotejava/OBSRemoteController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void connect() {
6666
URI uri = new URI(address);
6767
ClientUpgradeRequest request = new ClientUpgradeRequest();
6868
Future<Session> connection = client.connect(communicator, uri, request);
69-
log.info("Connecting to: %s%s.%n", uri, (password != null ? " with password" : ""));
69+
log.info(String.format("Connecting to: %s%s.%n", uri, (password != null ? " with password" : "")));
7070

7171
try {
7272
connection.get();

0 commit comments

Comments
 (0)