Skip to content

Commit ba57ecd

Browse files
committed
Fixed the absent error message texts when database connection doesn't work. Also added text messages for curl errors.
1 parent 93a92a8 commit ba57ecd

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

src/FMDataAPI.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,14 @@ public function curlErrorCode()
194194
{
195195
return $this->provider->curlErrorNumber;
196196
}
197+
/**
198+
* The error message of curl, text representation of code.
199+
* @return int The error number of curl.
200+
*/
201+
public function curlErrorMessage()
202+
{
203+
return $this->provider->curlError;
204+
}
197205

198206
/**
199207
* The HTTP status code of the latest response from the REST API.

src/Supporting/CommunicationProvider.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class CommunicationProvider
8383
* @var
8484
* @ignore
8585
*/
86-
protected $curlError;
86+
public $curlError;
8787
/**
8888
* @var
8989
* @ignore
@@ -747,7 +747,7 @@ public function storeToProperties()
747747
$this->totalCount = null;
748748
$this->foundCount = null;
749749
$this->returnedCount = null;
750-
750+
$this->errorMessage = null;
751751

752752
if (property_exists($this, 'responseBody')) {
753753
$rbody = $this->responseBody;
@@ -756,6 +756,7 @@ public function storeToProperties()
756756
$result = $rbody->messages[0];
757757
$this->httpStatus = $this->getCurlInfo("http_code");
758758
$this->errorCode = property_exists($result, 'code') ? $result->code : -1;
759+
$this->errorMessage = property_exists($result, 'message') && $result->code != 0 ? $result->message : null;
759760
}
760761
if (property_exists($rbody, 'response')) {
761762
$result = $rbody->response;

0 commit comments

Comments
 (0)