sendcloud-php-client icon indicating copy to clipboard operation
sendcloud-php-client copied to clipboard

Fatal error when parsing response (on 404 not found)

Open leeuweriq opened this issue 9 years ago • 0 comments

Getting this error when trying to fetch a Sendcloud label that returns a 404 not found:

Recoverable fatal error: Object of class GuzzleHttp\Psr7\Response could not be converted to string in (...)/vendor/picqer/sendcloud-php-client/src/Picqer/Carriers/SendCloud/Connection.php on line 128

Apparently a response object is returned and the SendCloudException tries to get the exception response message and concats it in the exception message (see line 128 in Connection):

throw new SendCloudApiException('SendCloud error: (no error message provided)' . $e->getResponse(), $e->getResponse()->getStatusCode());

...which in turn results in the fatal error.

Package version: 2.3.9 (Uses GuzzleHTTP 6.3.0) Running PHP 7.1

leeuweriq avatar Nov 15 '17 10:11 leeuweriq