Skip to content
Snippets Groups Projects
Commit 7b4f7c08 authored by Tim van Dijen's avatar Tim van Dijen Committed by Tim van Dijen
Browse files

Properly handle error conditions

parent b5dfc396
No related branches found
No related tags found
No related merge requests found
......@@ -206,8 +206,14 @@ class BuiltInServer
CURLOPT_HEADER => 1,
]);
curl_setopt_array($ch, $curlopts);
/** @var mixed $resp */
/** @psalm-var array|false $resp RETURNTRANSFER was set to true */
$resp = curl_exec($ch);
if ($resp === false) {
throw new \Exception("Unable to contact: " . $url);
}
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
list($header, $body) = explode("\r\n\r\n", $resp, 2);
$raw_headers = explode("\r\n", $header);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment