diff --git a/common/src/main/java/me/lucko/luckperms/common/webeditor/WebEditorSession.java b/common/src/main/java/me/lucko/luckperms/common/webeditor/WebEditorSession.java index cb29b1bbd..16611a0f3 100644 --- a/common/src/main/java/me/lucko/luckperms/common/webeditor/WebEditorSession.java +++ b/common/src/main/java/me/lucko/luckperms/common/webeditor/WebEditorSession.java @@ -98,16 +98,25 @@ public class WebEditorSession { this.socket = socket; this.plugin.getWebEditorStore().sockets().putSocket(this.sender, this.socket); } catch (Exception e) { - if (e instanceof UnsuccessfulRequestException && ((UnsuccessfulRequestException) e).getResponse().code() == 502) { - // 502 - bad gateway, probably means the socket service is offline - // that's ok, no need to send a warning - return; + if (!ignoreSocketConnectError(e)) { + this.plugin.getLogger().warn("Unable to establish socket connection", e); } - - this.plugin.getLogger().warn("Unable to establish socket connection", e); } } + private static boolean ignoreSocketConnectError(Exception e) { + if (e instanceof UnsuccessfulRequestException) { + UnsuccessfulRequestException req = (UnsuccessfulRequestException) e; + int code = req.getResponse().code(); + + // 502 - bad gateway / 503 - service unavailable + // probably means the socket service is offline, that's ok, no need to send a warning + return code == 502 || code == 503; + } + + return false; + } + private void createInitialSession() { Objects.requireNonNull(this.initialRequest);