Explorar o código

added proper exception on connect.

Nicolas Cannasse %!s(int64=19) %!d(string=hai) anos
pai
achega
35cfa8d44a
Modificáronse 1 ficheiros con 8 adicións e 1 borrados
  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) {
-		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) {