Skip to content

Commit

Permalink
Merge pull request #4 from pionl/master
Browse files Browse the repository at this point in the history
Fix HTTP error message building
  • Loading branch information
filipsedivy authored May 2, 2023
2 parents 911ca45 + 6b6674e commit 175bbf1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Helpers/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ private function loadContent(): void
$content = @file_get_contents($this->url, false, $context);

if ($content === false) {
throw new Exceptions\CoreException(error_get_last()['message']);
$error = error_get_last();
$message = $error === null || array_key_exists('message', $error) === false ? 'HTTP failed' : $error['message'];
throw new Exceptions\CoreException($message);
}

$this->content = $content;
Expand Down

0 comments on commit 175bbf1

Please sign in to comment.