From 2d76d7f5833904612eebad031d0dc321024ca959 Mon Sep 17 00:00:00 2001 From: Niklas Keller Date: Tue, 12 Sep 2017 20:08:20 +0200 Subject: [PATCH] Expose error code in exceptions --- lib/functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/functions.php b/lib/functions.php index 8743604..50e17e8 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -47,7 +47,7 @@ function listen(string $uri, ServerListenContext $socketContext = null, ServerTl $server = @\stream_socket_server($uri, $errno, $errstr, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $context); if (!$server || $errno) { - throw new SocketException(\sprintf("Could not create server %s: [Error: #%d] %s", $uri, $errno, $errstr)); + throw new SocketException(\sprintf("Could not create server %s: [Error: #%d] %s", $uri, $errno, $errstr), $errno); } return new Server($server, 65536); @@ -104,7 +104,7 @@ function connect(string $uri, ClientConnectContext $socketContext = null, Cancel $uri, $errno, $errstr - )); + ), $errno); } \stream_set_blocking($socket, false);