From caae119ba2a140af5aacefa1d1f18cc6699abfd2 Mon Sep 17 00:00:00 2001 From: nuxsmin Date: Mon, 9 Jan 2017 01:40:18 +0100 Subject: [PATCH] * [DEV] More info on CURL error --- inc/SP/Util/Util.class.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/inc/SP/Util/Util.class.php b/inc/SP/Util/Util.class.php index 1780596b..976fc093 100644 --- a/inc/SP/Util/Util.class.php +++ b/inc/SP/Util/Util.class.php @@ -259,8 +259,14 @@ class Util $data = curl_exec($ch); - if ($data === false) { - $Log = Log::writeNewLog(__FUNCTION__, curl_error($ch)); + $httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE); + + if ($data === false || $httpStatus !== 200) { + $Log = new Log(__FUNCTION__); + $Log->setLogLevel(Log::ERROR); + $Log->addDescription(curl_error($ch)); + $Log->addDetails(_('Respuesta'), $httpStatus); + $Log->writeLog(); throw new SPException(SPException::SP_WARNING, $Log->getDescription()); }