diff options
author | Frédéric Guillot <fred@kanboard.net> | 2019-06-04 15:57:07 -0700 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2019-06-04 15:57:07 -0700 |
commit | 4ebcf84d47666bc649bd6a0624bd2ab0d3f4a405 (patch) | |
tree | 3b523153e76d0fd08462a98a02bf77daa0cba269 /app/Core/Http/Client.php | |
parent | c81d9013d4fd46a0a6c7e9c4b23962e764540de5 (diff) |
Display cURL error message in logs
Diffstat (limited to 'app/Core/Http/Client.php')
-rw-r--r-- | app/Core/Http/Client.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/app/Core/Http/Client.php b/app/Core/Http/Client.php index 230a5958..d875fe67 100644 --- a/app/Core/Http/Client.php +++ b/app/Core/Http/Client.php @@ -265,14 +265,16 @@ class Client extends Base $body = curl_exec($curlSession); - if (! $body) { - $this->logger->error('HttpClient: request failed ('.$url.')'); + if ($body === false) { + $errorMsg = curl_error($curlSession); + curl_close($curlSession); + + $this->logger->error('HttpClient: request failed ('.$url.' - '.$errorMsg.')'); if ($raiseForErrors) { - throw new ClientException('Unreachable URL: '.$url); + throw new ClientException('Unreachable URL: '.$url.' ('.$errorMsg.')'); } - curl_close($curlSession); return ''; } |