Closed AlexeyKosov closed 3 years ago
I have the same problem. API client returns only 'data' key for updatePeopleProfile(). But its empty as for good ('updated') case as for bad (_'people_notfound') case. Does not exists success/failed marker.
-- Otherwise, for updatePeopleData() API client returns all response data.
Hello guys! I've issued an update on the PHP wrapper to have more complete error details.
For example, this code...
try {
$result = $CrispClient->buckets->generate([
"foo" => "bar"
]);
var_dump($result);
} catch (\Crisp\CrispException $exception) {
var_dump($exception->getError());
}
...throws an exception with all the necessary details:
array(4) {
["reason"]=>
string(5) "error"
["message"]=>
string(12) "invalid_data"
["code"]=>
int(400)
["data"]=>
array(2) {
["namespace"]=>
string(8) "response"
["message"]=>
string(66) "Got response error: data should have required property 'namespace'"
}
}
This is available in version 1.6.3 😊
The current implementation does not allow finding out if a request returned an error and what the error was. If, for example, the server returns
{"error":true,"reason":"people_exists","data":{}}
, the API client will return only{}
(only thedata
key is returned).It would make sense to throw an error in such a case or add any other ability to handle errors.