Skip to content

Commit

Permalink
add error message to failed requests
Browse files Browse the repository at this point in the history
  • Loading branch information
sc committed Mar 25, 2024
1 parent 76a2184 commit 8a24d4f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/HttpClient/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ public function sendRequest(Request $request, Options $options): Response

curl_close($curlHandle);

return new Response($statusCode, $responseHeaders, '');
$error = '';

if ($statusCode >= 200 && $statusCode <= 299) {
$error = $body;
}

return new Response($statusCode, $responseHeaders, $error);

Check failure on line 114 in src/HttpClient/HttpClient.php

View workflow job for this annotation

GitHub Actions / PHPStan

Parameter #3 $error of class Sentry\HttpClient\Response constructor expects string, string|true given.
}
}

0 comments on commit 8a24d4f

Please sign in to comment.