From f276a30a47be06ef1b406ee2df094bcf8f6e84e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Bechyn=C4=9B?= Date: Sat, 18 Feb 2017 00:13:02 +0100 Subject: [PATCH] Curl/WsdlGenerator - better error handling --- src/BeSimple/SoapClient/Curl/Curl.php | 2 +- src/BeSimple/SoapClient/WsdlDownloader.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BeSimple/SoapClient/Curl/Curl.php b/src/BeSimple/SoapClient/Curl/Curl.php index 53121d6..65ee796 100644 --- a/src/BeSimple/SoapClient/Curl/Curl.php +++ b/src/BeSimple/SoapClient/Curl/Curl.php @@ -158,7 +158,7 @@ class Curl $location ); - if (!is_integer($httpResponseCode) || $httpResponseCode >= 400) { + if (!is_integer($httpResponseCode) || $httpResponseCode >= 400 || $httpResponseCode === 0) { return new CurlResponse( $httpRequestHeadersAsString, diff --git a/src/BeSimple/SoapClient/WsdlDownloader.php b/src/BeSimple/SoapClient/WsdlDownloader.php index f1bf1b4..87eb633 100644 --- a/src/BeSimple/SoapClient/WsdlDownloader.php +++ b/src/BeSimple/SoapClient/WsdlDownloader.php @@ -75,7 +75,7 @@ class WsdlDownloader $curlResponse = $curl->executeCurlWithCachedSession($wsdlPath); if ($curlResponse->curlStatusSuccess()) { if (mb_strlen($curlResponse->getResponseBody()) === 0) { - throw new Exception('Could not write WSDL cache file: curl response empty'); + throw new Exception('Could not write WSDL cache file: empty curl response from: '.$wsdlPath); } if ($resolveRemoteIncludes === true) { $document = $this->getXmlFileDOMDocument($curl, $cacheType, $curlResponse->getResponseBody(), $wsdlPath);