Browse Source

added proper exception on connect.

Nicolas Cannasse 19 years ago
parent
commit
35cfa8d44a
1 changed files with 8 additions and 1 deletions
  1. 8 1
      std/neko/io/Socket.hx

+ 8 - 1
std/neko/io/Socket.hx

@@ -64,7 +64,14 @@ class Socket {
 	}
 	}
 
 
 	public function connect(host : Host, port : Int) {
 	public function connect(host : Host, port : Int) {
-		socket_connect(__s, host, port);
+		try {
+			socket_connect(__s, host, port);
+		} catch( s : String ) {
+			if( s == "std@socket_connect" )
+				throw "Failed to connect on "+reverse(host)+":"+port;
+			else
+				neko.Lib.rethrow(s);
+		}
 	}
 	}
 
 
 	public function listen(connections : Int) {
 	public function listen(connections : Int) {