class RestException in Salesforce Suite 8.4
Same name and namespace in other branches
- 8.3 src/Rest/RestException.php \Drupal\salesforce\Rest\RestException
- 5.0.x src/Rest/RestException.php \Drupal\salesforce\Rest\RestException
Class RestException.
@package Drupal\salesforce\Rest
Hierarchy
- class \Drupal\salesforce\Rest\RestException extends \Drupal\salesforce\Rest\RuntimeException implements \Symfony\Component\Serializer\Exception\ExceptionInterface
Expanded class hierarchy of RestException
3 files declare their use of RestException
- PullBase.php in modules/
salesforce_pull/ src/ Plugin/ QueueWorker/ PullBase.php - SalesforceCommands.php in src/
Commands/ SalesforceCommands.php - salesforce_example-apex_endpoint.php in modules/
salesforce_example/ salesforce_example-apex_endpoint.php
File
- src/
Rest/ RestException.php, line 13
Namespace
Drupal\salesforce\RestView source
class RestException extends \RuntimeException implements ExceptionInterface {
/**
* The current Response.
*
* @var \Psr\Http\Message\ResponseInterface|null
*/
protected $response;
/**
* The response body.
*
* @var string
*/
protected $body;
/**
* RestException constructor.
*
* @param \Psr\Http\Message\ResponseInterface|null $response
* A response, if available.
* @param string $message
* Message (optional).
* @param int $code
* Erorr code (optional).
* @param \Exception|null $previous
* Previous exception (optional).
*/
public function __construct(ResponseInterface $response = NULL, $message = "", $code = 0, \Exception $previous = NULL) {
$this->response = $response;
$message .= $this
->getResponseBody();
parent::__construct($message, $code, $previous);
}
/**
* Getter.
*
* @return null|\Psr\Http\Message\ResponseInterface
* The response.
*/
public function getResponse() {
return $this->response;
}
/**
* Getter.
*
* @return string|null
* The response body.
*/
public function getResponseBody() {
if ($this->body) {
return $this->body;
}
if (!$this->response) {
return NULL;
}
$body = $this->response
->getBody();
if ($body) {
$this->body = $body
->getContents();
return $this->body;
}
return '';
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RestException:: |
protected | property | The response body. | |
RestException:: |
protected | property | The current Response. | |
RestException:: |
public | function | Getter. | |
RestException:: |
public | function | Getter. | |
RestException:: |
public | function | RestException constructor. |