From b10ace1db7a2ccbd1b74b1b4547bf99d3cc12980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Pablo=20Villafa=C3=B1ez?= Date: Thu, 24 Jul 2014 17:29:02 +0200 Subject: [PATCH] Throw connection errors in some extra cases --- src/NativeShare.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/NativeShare.php b/src/NativeShare.php index 57180c3..4246b72 100644 --- a/src/NativeShare.php +++ b/src/NativeShare.php @@ -111,6 +111,13 @@ class NativeShare implements IShare { throw new InvalidHostException($errstr); } else if (strpos($errstr, 'Permission denied')) { throw new AccessDeniedException($errstr); + } else if (strpos($errstr, 'unknown error (110)') or + strpos($errstr, 'unknown error (111)') or + strpos($errstr, 'unknown error (112)') or + strpos($errstr, 'unknown error (113)')) { + // errors for connection timeout, connection refused, host is down and + // no route to host, respectively + throw new ConnectionError($errstr); } else { throw new \Exception($errstr); }