From 7f1c4e8b5c8a723bd69db58d462af1c3c5911442 Mon Sep 17 00:00:00 2001 From: Sander van Leeuwen Date: Wed, 19 Oct 2016 12:21:31 +0200 Subject: [PATCH] Use the availability of an _error object to determine if the request was successful or not. See http://dev.frontapp.com/#response-body-structure --- src/FrontApp.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/FrontApp.php b/src/FrontApp.php index 45d53b8..97d1619 100644 --- a/src/FrontApp.php +++ b/src/FrontApp.php @@ -246,8 +246,8 @@ private function formatResponse($response) $d = json_decode($response['body'], true); - if (isset($d['status']) && $d['status'] != '200' && isset($d['detail'])) { - $this->last_error = sprintf('%d: %s', $d['status'], $d['detail']); + if (isset($d['_error'])) { + $this->last_error = sprintf('%d: %s', $d['_error']['status'], $d['_error']['message']); } else { $this->request_successful = true; }