Skip to content

Commit a86972c

Browse files
authored
Merge pull request #37 from darnel/master
Fix handling non-HTTP errors
2 parents 7d7eb13 + 561ac47 commit a86972c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

FMDataAPI.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ public function query($condition = null, $sort = null, $offset = -1, $range = -1
542542
property_exists($result->response, 'data') &&
543543
property_exists($result, 'messages')
544544
) {
545-
$fmrel = new FileMakerRelation($result->response->data,
545+
$fmrel = new FileMakerRelation($result->response->data,
546546
property_exists($result->response, 'dataInfo') ? $result->response->dataInfo : null,
547547
"OK", $result->messages[0]->code, null, $this->restAPI);
548548
}
@@ -1997,9 +1997,9 @@ public function callRestAPI($params, $isAddToken, $method = 'GET', $request = nu
19971997
}
19981998
if ($this->throwExceptionInError) {
19991999
$httpStatus = $this->getCurlInfo("http_code");
2000-
$errorCode = property_exists($this->responseBody->messages[0], 'code') ?
2000+
$errorCode = $this->responseBody && property_exists($this->responseBody->messages[0], 'code') ?
20012001
intval($this->responseBody->messages[0]->code) : -1;
2002-
$errorMessage = property_exists($this->responseBody->messages[0], 'message') ?
2002+
$errorMessage = $this->responseBody && property_exists($this->responseBody->messages[0], 'message') ?
20032003
$this->responseBody->messages[0]->message : 'ERROR';
20042004
$description = '';
20052005
if ($this->curlErrorNumber > 0) {

0 commit comments

Comments
 (0)