From 2fb4775ca7ce0b5bdd3b895e7674da566adacf3f Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Thu, 16 Mar 2023 12:29:43 +0100 Subject: [PATCH] Try to fix some stuff with websocket --- .../java/fr/pandacube/lib/ws/client/AbstractClientWS.java | 2 +- .../java/fr/pandacube/lib/ws/payloads/ErrorPayload.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pandalib-ws-client/src/main/java/fr/pandacube/lib/ws/client/AbstractClientWS.java b/pandalib-ws-client/src/main/java/fr/pandacube/lib/ws/client/AbstractClientWS.java index c8893de..c1e7172 100644 --- a/pandalib-ws-client/src/main/java/fr/pandacube/lib/ws/client/AbstractClientWS.java +++ b/pandalib-ws-client/src/main/java/fr/pandacube/lib/ws/client/AbstractClientWS.java @@ -110,7 +110,7 @@ public abstract class AbstractClientWS implements AbstractWS { public final void sendClose(int code, String reason) throws IOException { synchronized (socket) { autoReconnect = false; // if we ask for closing connection, dont reconnect automatically - socket.get().sendClose(code, reason); + socket.get().sendClose(code, reason).join(); } } diff --git a/pandalib-ws/src/main/java/fr/pandacube/lib/ws/payloads/ErrorPayload.java b/pandalib-ws/src/main/java/fr/pandacube/lib/ws/payloads/ErrorPayload.java index 6c69902..37ca2f6 100644 --- a/pandalib-ws/src/main/java/fr/pandacube/lib/ws/payloads/ErrorPayload.java +++ b/pandalib-ws/src/main/java/fr/pandacube/lib/ws/payloads/ErrorPayload.java @@ -1,5 +1,7 @@ package fr.pandacube.lib.ws.payloads; +import fr.pandacube.lib.util.ThrowableUtil; + /** * Error message payload. */ @@ -11,7 +13,7 @@ public class ErrorPayload extends Payload { /** * The error Throwable, may be null. */ - public Throwable throwable; + public String exception; /** * Initialize an error payload with a message but not throwable. @@ -28,7 +30,7 @@ public class ErrorPayload extends Payload { */ public ErrorPayload(String message, Throwable throwable) { this.message = message; - this.throwable = throwable; + this.exception = ThrowableUtil.stacktraceToString(throwable); } @SuppressWarnings("unused")