From c3ece5fc002c71a4189e8bbac8e67e0fc21946ab Mon Sep 17 00:00:00 2001 From: "Tristan B. Kildaire" Date: Fri, 18 Dec 2020 18:02:57 +0200 Subject: [PATCH] `setProperty()` now throws exception on network error --- source/libdnet/client.d | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/source/libdnet/client.d b/source/libdnet/client.d index 0348110..d77d2a8 100644 --- a/source/libdnet/client.d +++ b/source/libdnet/client.d @@ -347,15 +347,24 @@ public final class DClient /* Send the protocol data */ DataMessage protocolData = new DataMessage(reqRepQueue.getTag(), data); - bSendMessage(socket, protocolData.encode()); + bool status = bSendMessage(socket, protocolData.encode()); - /* Receive the server's response */ - byte[] resp = reqRepQueue.dequeue().getData(); - - /* If it worked */ - if(cast(bool)resp[0]) + /* If the send worked */ + if(status) { - + /* Receive the server's response */ + byte[] resp = reqRepQueue.dequeue().getData(); + + /* If it worked */ + if(cast(bool)resp[0]) + { + + } + } + /* If the send failed */ + else + { + throw new DNetworkError("setprop"); } }