class ServicesClientConnectionResponseException in Services Client 7.2
Same name and namespace in other branches
- 7 services_client_connection/include/exception.inc \ServicesClientConnectionResponseException
Common parent class for all services client module exceptions
Hierarchy
- class \ServicesClientConnectionResponseException extends \Exception
Expanded class hierarchy of ServicesClientConnectionResponseException
File
- services_client_connection/
include/ exception.inc, line 25 - Custom exception definitions
View source
class ServicesClientConnectionResponseException extends Exception {
/**
* Whole response that represents failed request
*
* @var ServicesClientConnectionResponse
*/
public $response;
/**
* Request that has been made to server
*
* @var ServicesClientConnectionHttpRequest
*/
public $request;
public function __construct($response, $request, $message = NULL, $code = NULL) {
// Save request and response source
$this->response = $response;
$this->request = $request;
$message = empty($message) ? $this
->getServicesMessage() : $message;
parent::__construct($message, $code);
}
/**
* Dump request and response to watchdog
*
* @param $severity
* Watchdog severity default set to ERROR
*/
public function log($severity = WATCHDOG_ERROR) {
watchdog('scc', 'Request: <pre>@request</pre> Error response: <pre>@response</pre>', array(
'@request' => print_r($this->request, TRUE),
'@response' => print_r($this->response, TRUE),
), $severity);
}
/**
* Provide human readable error mesage.
*/
public function getServicesMessage() {
$msg = $this->response->error_code . ' ' . $this->response->error_message;
if (!empty($this->response->services_error)) {
$msg .= ': ' . $this->response->services_error;
}
return $msg;
}
/**
* Return error reponse code.
*
* @return int
* HTTP or cURL error code.
*/
public function getErrorCode() {
return $this->response->error_code;
}
/**
* Return error response message.
*
* @return string
* Description message.
*/
public function getErrorMessage() {
return $this->response->error_message;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ServicesClientConnectionResponseException:: |
public | property | Request that has been made to server | |
ServicesClientConnectionResponseException:: |
public | property | Whole response that represents failed request | |
ServicesClientConnectionResponseException:: |
public | function | Return error reponse code. | |
ServicesClientConnectionResponseException:: |
public | function | Return error response message. | |
ServicesClientConnectionResponseException:: |
public | function | Provide human readable error mesage. | |
ServicesClientConnectionResponseException:: |
public | function | Dump request and response to watchdog | |
ServicesClientConnectionResponseException:: |
public | function |