From 7cd6f85ff976d170e6d7b30fd0bca73773d9c0d2 Mon Sep 17 00:00:00 2001 From: Andrey Chirikba Date: Fri, 9 Nov 2018 21:29:12 +0100 Subject: [PATCH] Handle errors when updating/inserting multiple records --- src/Request/Response.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Request/Response.php b/src/Request/Response.php index 3ec9ef7..ffbc241 100644 --- a/src/Request/Response.php +++ b/src/Request/Response.php @@ -241,10 +241,16 @@ protected function parseResponse() //preg_match('/[0-9]{18}/', $this->message, $matches); //$this->recordId = $matches[0]; } + + // updateRelatedRecords + elseif (isset($xml->result->success->code)) { + $this->code = (string) $xml->result->success->code; + $this->message = 'success'; // We use this string below to determine the successfulness of the call + } // downloadFile else { - throw new ZohoCRMException('Unknown Zoho CRM response format.'); + throw new ZohoCRMException('Unknown Zoho CRM response format'); } } } @@ -368,6 +374,8 @@ protected function parseResponsePostRecordsMultiple($xml) } else { $records[$no]['code'] = (string) $row->error->code; $records[$no]['message'] = (string) $row->error->details; + $this->code = (string) $row->error->code; + $this->message = (string) $row->error->details; } } ksort($records);