本文整理汇总了PHP中Exception::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP Exception::getData方法的具体用法?PHP Exception::getData怎么用?PHP Exception::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Exception
的用法示例。
在下文中一共展示了Exception::getData方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createHttpResponseFromException
/**
* Create new HttpResponse from exception.
*
* @param \Exception $exception
*
* @return HttpResponse
*/
protected function createHttpResponseFromException(\Exception $exception)
{
$httpResponse = HttpResponse::create();
$json = [];
$json['jsonrpc'] = '2.0';
$json['error'] = [];
if ($exception instanceof Exceptions\ErrorException) {
$json['error']['code'] = $exception->getCode();
$json['error']['message'] = $exception->getMessage();
if ($exception->getData()) {
$json['error']['data'] = $exception->getData();
}
$json['id'] = $exception->getId();
} else {
$json['error']['code'] = -32603;
$json['error']['message'] = 'Internal error';
$json['id'] = null;
}
$httpResponse->headers->set('Content-Type', 'application/json');
$httpResponse->setContent(json_encode($json));
$httpResponse->setStatusCode(500);
return $httpResponse;
}
示例2: getDetails
/**
* Returns an array of details about this error
*
* @return Array
*/
public function getDetails()
{
if (!$this->exception instanceof \r8\Exception) {
return array();
}
return array("Exception" => '\\' . get_class($this->exception), "Description" => $this->exception->getDescription()) + $this->exception->getData();
}
示例3: _handleException
protected function _handleException(\Exception $e)
{
try {
throw $e;
} catch (\Requests_Exception $e) {
if (is_resource($e->getData())) {
$errNo = curl_errno($e->getData());
switch ($errNo) {
case 7:
throw new ServiceUnavailableException($e->getMessage(), 503, $e);
case 28:
throw new RequestTimeoutException($e->getMessage(), 408, $e);
}
}
} catch (ApiException $e) {
throw $e;
}
throw new ServerApiException($e->getMessage(), 500, $e);
}
示例4: whatProvidesManageException
/**
* {@inheritdoc}
*/
protected function whatProvidesManageException(Pool $pool, $name, \Exception $exception)
{
if ($exception instanceof InvalidCreateRepositoryException) {
$data = $exception->getData();
if (isset($data['versions']) && !empty($data['versions'])) {
$this->putArrayRepositoryConfig($data['versions'], $name, $pool);
return;
}
}
parent::whatProvidesManageException($pool, $name, $exception);
}
示例5: __construct
/**
* Erstellt die Ausnahme mit der Möglichkeit zusätzliche Daten anzugeben
* @param string $message
* @param array $data
* @param int $code
* @param Exception $previous
*/
public function __construct($message = '', array $data = array(), $code = 0, Exception $previous = null)
{
if (isset($previous)) {
if ($message == '') {
$message = $previous->getMessage();
}
if (count($data) == 0 && $previous instanceof Dragon_Application_Exception_Abstract) {
$data = $previous->getData();
}
if ($code == 0) {
$code = $previous->getCode();
}
}
$this->_data = $data;
parent::__construct($message, $code, $previous);
}
示例6: translateException
/**
* @param \Exception $exception
* @return \Exception
*/
protected function translateException(\Exception $exception)
{
if ($exception instanceof PayPalConfigurationException || $exception instanceof PayPalInvalidCredentialException || $exception instanceof PayPalMissingCredentialException || $exception instanceof PayPalConnectionException) {
return new PayPalException($exception->getMessage() . 'Data: ' . $exception->getData(), $exception->getCode(), $exception);
}
return $exception;
}
示例7: logException
protected function logException($level, \Exception $exception)
{
$component = 'unknown';
if ($this->job != null) {
$component = $this->job->getComponent();
}
$exceptionId = $component . '-' . md5(microtime());
$logData = ['exceptionId' => $exceptionId, 'exception' => $exception];
// SyrupExceptionInterface holds additional data
if ($exception instanceof SyrupExceptionInterface) {
$logData['data'] = $exception->getData();
}
$this->logger->{$level}($exception->getMessage(), $logData);
return $exceptionId;
}
示例8: printError
/**
* Prints Error
*
* @param $title
* @param $objectName
* @param null $objectId
* @param null $request
* @param \Exception $exception
*/
public static function printError($title, $objectName, $objectId = null, $request = null, $exception = null)
{
$data = null;
if ($exception instanceof \PayPal\Exception\PayPalConnectionException) {
$data = $exception->getData();
}
self::printOutput($title, $objectName, $objectId, $request, $data, $exception->getMessage());
}
示例9: renderException
/**
* @param \Exception $e
* @return array
*/
public static function renderException($e)
{
if ($e instanceof PayPal\ErrorResponseException) {
return array('tab' => 'PayPalRequest', 'panel' => '<p><b>Request:</b></p>' . Nette\Diagnostics\Helpers::clickableDump($e->getData(), TRUE) . '<p><b>Response:</b></p>' . Nette\Diagnostics\Helpers::clickableDump($e->getResponse(), TRUE));
}
}
示例10: getExtendData
/**
* 获取异常扩展信息
* 用于非调试模式html返回类型显示
* @param \Exception $exception
* @return array 异常类定义的扩展数据
*/
private static function getExtendData(\Exception $exception)
{
$data = [];
if ($exception instanceof Exception) {
$data = $exception->getData();
}
return $data;
}
示例11: handleException
/**
* Show Exception if debug mode.
*
* @param Exception $e
*/
public function handleException(Exception $e)
{
if (Mage::getStoreConfig('iways_paypalplus/dev/debug')) {
Mage::getSingleton('core/session')->addWarning($e->getData());
}
}
示例12: printError
/**
* Prints Error
*
* @param $title
* @param $objectName
* @param null $objectId
* @param null $request
* @param \Exception $exception
* @param bool $forceConsole
*/
public static function printError($title, $objectName, $objectId = null, $request = null, $exception = null, $forceConsole = false)
{
$data = null;
if ($exception instanceof \BlockCypher\Exception\BlockCypherConnectionException) {
$data = $exception->getData();
}
self::printOutput($title, $objectName, $objectId, $request, $data, $exception->getMessage(), $forceConsole);
}
示例13: notifyException
/**
* Notify Exception
* @param Exception $exception
*/
public function notifyException(Exception $exception)
{
$data = array();
if ($exception instanceof ErrorNotException) {
$data['exception_data'] = $exception->getData();
}
if ($this->dump_session_data && isset($_SESSION)) {
$data['SESSION'] = $_SESSION;
}
$this->notify($exception->getMessage(), null, $exception->getTrace(), array('params' => array('post' => $_POST, 'get' => $_GET, 'cookies' => $_COOKIE)), $_SERVER, $data);
if (!is_null($this->previous_exception_handler)) {
call_user_func($this->previous_exception_handler, $exception);
}
}
示例14: compileError
/**
* compile error object to be returned
*
* @error 14609
* @param Exception $error
* @return array
*/
protected final function compileError(Exception $error)
{
$e = array();
if ($error instanceof Xapp_Rpc_Fault) {
$e['code'] = $this->getFault($error->getCode());
} else {
$e['code'] = $error->getCode();
}
if (isset($GLOBALS['_RPC']) && isset($GLOBALS['_RPC']['OMIT_ERROR']) && (bool) $GLOBALS['_RPC']['OMIT_ERROR']) {
$e['message'] = null;
} else {
$e['message'] = $error->getMessage();
if ($error instanceof Xapp_Rpc_Fault && $error->hasData()) {
$e['data'] = $error->getData();
}
}
return $e;
}