Skip to content
Snippets Groups Projects
Commit c78059a3 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Store the socket error description before closing the socket.

Also, don't include "error" in the Error message.
Also, socket error strings can be quite long on Windows (e.g. >128 chars)
so place at the end of the Error message.
parent 8336ea34
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #244 passed
...@@ -102,9 +102,10 @@ function JSONClient(serverAddr,serverPort) { ...@@ -102,9 +102,10 @@ function JSONClient(serverAddr,serverPort) {
this.socket=new Socket(); this.socket=new Socket();
if(!this.socket.connect(this.serverAddr,this.serverPort,this.settings.CONNECTION_TIMEOUT)) { if(!this.socket.connect(this.serverAddr,this.serverPort,this.settings.CONNECTION_TIMEOUT)) {
var connect_error = this.socket.error var connect_error = this.socket.error;
var connect_error_str = this.socket.error_str;
this.socket.close(); this.socket.close();
throw new Error("error " + connect_error + " (" + socket_errno_str + ") connecting to TCP port " + this.serverPort + " on server " + this.serverAddr); throw new Error(connect_error + " connecting to TCP port " + this.serverPort + " on server " + this.serverAddr + ": " + connect_error_str);
} }
return true; return true;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment