diff --git a/lib/Client/FileGetContents.php b/lib/Client/FileGetContents.php index cdbe89f6..5e8e7b3b 100644 --- a/lib/Client/FileGetContents.php +++ b/lib/Client/FileGetContents.php @@ -22,9 +22,10 @@ public function sendRequest(RequestInterface $request, array $options = []): Res $content = file_get_contents($request->getUri()->__toString(), false, $context); error_reporting($level); if (false === $content) { - $error = error_get_last(); - - throw new NetworkException($request, $error['message']); + if ($error = error_get_last()) { + throw new NetworkException($request, $error['message']); + } + throw new NetworkException($request, 'Failed to get contents from '.$request->getUri()->__toString()); } $requestBuilder = new ResponseBuilder($this->responseFactory);