protected function RestClient::getErrorData in Salesforce Suite 8.4
Same name and namespace in other branches
- 8.3 src/Rest/RestClient.php \Drupal\salesforce\Rest\RestClient::getErrorData()
- 5.0.x src/Rest/RestClient.php \Drupal\salesforce\Rest\RestClient::getErrorData()
Extract normalized error information from a RequestException.
Parameters
\GuzzleHttp\Exception\RequestException $e: Exception object.
Return value
array Error array with keys:
- message
- errorCode
- fields
File
- src/
Rest/ RestClient.php, line 346
Class
- RestClient
- Objects, properties, and methods to communicate with the Salesforce REST API.
Namespace
Drupal\salesforce\RestCode
protected function getErrorData(RequestException $e) {
$response = $e
->getResponse();
$response_body = $response
->getBody()
->getContents();
$data = $this->json
->decode($response_body);
if (!empty($data[0])) {
$data = $data[0];
}
return $data;
}