省略された(truncated)エラーメッセージ
Guzzleによるリクエストが失敗したとき、次のようにエラーメッセージが省略されている場合があります。
Client error: `POST https://example.com/xxx` resulted in a `400 Bad Request` response:
{"error_type": "OAuthException", "code": 400, "error_message": "Error validating. Please make sure you (truncated...)
エラーメッセージをすべて取得する
エラーメッセージをすべて取得するには、catchした例外の変数(この場合は$e)に対して、getResponse()->getBody()->getContents()を実行すると、エラーメッセージをすべて取得できます。
$e->getResponse()->getBody()->getContents()
Client error: `POST https://example.com/xxx` resulted in a `400 Bad Request` response:
{"error_type": "OAuthException", "code": 400, "error_message": "Error validating. Please make sure your xxx is xxx to the one you used in the xxx"}