当前位置: 首页>>代码示例>>PHP>>正文


PHP Exception::getData方法代码示例

本文整理汇总了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;
 }
开发者ID:timiki,项目名称:rpc-server-bundle,代码行数:30,代码来源:Handler.php

示例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();
 }
开发者ID:Nycto,项目名称:Round-Eights,代码行数:12,代码来源:Exception.php

示例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);
 }
开发者ID:fortifi,项目名称:api,代码行数:19,代码来源:RequestsConnection.php

示例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);
 }
开发者ID:stefangr,项目名称:composer-asset-plugin,代码行数:14,代码来源:NpmRepository.php

示例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);
 }
开发者ID:dragonprojects,项目名称:dragonjsonserver,代码行数:23,代码来源:Abstract.php

示例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;
 }
开发者ID:Trejjam,项目名称:PayPal,代码行数:11,代码来源:BasePaymentOperation.php

示例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;
 }
开发者ID:keboola,项目名称:syrup,代码行数:15,代码来源:JobCommand.php

示例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());
 }
开发者ID:kayecandy,项目名称:secudev,代码行数:17,代码来源:common.php

示例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));
     }
 }
开发者ID:Hajneej,项目名称:PayPalExpress,代码行数:10,代码来源:Panel.php

示例10: getExtendData

 /**
  * 获取异常扩展信息
  * 用于非调试模式html返回类型显示
  * @param  \Exception $exception 
  * @return array                 异常类定义的扩展数据
  */
 private static function getExtendData(\Exception $exception)
 {
     $data = [];
     if ($exception instanceof Exception) {
         $data = $exception->getData();
     }
     return $data;
 }
开发者ID:gg1122,项目名称:think,代码行数:14,代码来源:Error.php

示例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());
     }
 }
开发者ID:gaiterjones,项目名称:magento-iways-paypalplus,代码行数:11,代码来源:Data.php

示例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);
 }
开发者ID:toneloc,项目名称:php-client,代码行数:18,代码来源:common.php

示例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);
     }
 }
开发者ID:xrogaan,项目名称:php-errornot,代码行数:18,代码来源:errornot.php

示例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;
 }
开发者ID:xamiro-dev,项目名称:xamiro,代码行数:25,代码来源:Json.php


注:本文中的Exception::getData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。