api

Get the full message from your Guzzle Response exception object

Submitted by charles on

I was trying to debug a Guzzle response error but the error message was fairly long and some crucial information about which specific API fields were unauthorized was missing. The Guzzle Client Exception object has some handy methods to allow reading the full message contents:

$exception->getResponse()->getBody()->getContents();