From 06c444f4e3cf8d748d88fe1786371184b21d6ba3 Mon Sep 17 00:00:00 2001 From: Carlos Escribano Date: Wed, 18 Oct 2017 09:58:54 +0200 Subject: [PATCH] Fix error in utils Signed-off-by: Carlos Escribano --- CHANGELOG.md | 4 ++++ src/Management/Errors/Utils.php | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47d9b38..0467779 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ Version 5. ---------- +v5.6.2 +====== + - Fixed bug reading error response details. + v5.6.1 ====== * New features diff --git a/src/Management/Errors/Utils.php b/src/Management/Errors/Utils.php index 2bf5b02..09e5445 100644 --- a/src/Management/Errors/Utils.php +++ b/src/Management/Errors/Utils.php @@ -46,10 +46,10 @@ public static function handleErrors($statusCode, $response) { private static function readError($response) { $error = json_decode($response, true); - $error = $error['detail']; - - if (!isset($error)) { + if (is_null($error) || !isset($error['detail'])) { $error = $response; + } else { + $error = $error['detail']; } return $error;