You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RequestException::getResponse function ALWAYS (vendor/guzzlehttp/guzzle/src/Exception/ConnectException.php) return a null value when the request fails.
Possible solution
<?phpnamespaceCheckout;
useGuzzleHttp\Exception\RequestException;
class CheckoutApiException extends CheckoutException
{
/** * @var array */public$error_details;
/** * @var HttpMetadata */public$http_metadata;
/** * @param RequestException $requestException * @return CheckoutApiException */publicstaticfunctionfrom(RequestException$requestException)
{
$response = $requestException->getResponse();
$ex = newCheckoutApiException(sprintf(
"The API response status code (%s) does not indicate success.",
$requestException->getCode()
));
$ex->error_details = isset($response) ? json_decode($response->getBody()->getContents(), true) : [];;
$ex->http_metadata = CheckoutUtils::getHttpMetadata($response);
return$ex;
}
}
Additional information
Error: Call to a member function getBody() on null
Description
RequestException::getResponse function ALWAYS (vendor/guzzlehttp/guzzle/src/Exception/ConnectException.php) return a null value when the request fails.
Possible solution
Additional information
Error: Call to a member function getBody() on null
The text was updated successfully, but these errors were encountered: