Переглянути джерело

added proper exception on connect.

Nicolas Cannasse 19 роки тому
батько
коміт
35cfa8d44a
1 змінених файлів з 8 додано та 1 видалено
  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) {