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


PHP Exception::__toString方法代码示例

本文整理汇总了PHP中Exception::__toString方法的典型用法代码示例。如果您正苦于以下问题:PHP Exception::__toString方法的具体用法?PHP Exception::__toString怎么用?PHP Exception::__toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Exception的用法示例。


在下文中一共展示了Exception::__toString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: exceptionHandle

 public static function exceptionHandle(Exception $exception)
 {
     if (DEBUG_MODE) {
         //直接输出调试信息
         echo nl2br($exception->__toString());
         echo '<hr /><p>Router:</p><pre>';
         print_r(Singleton::getInstance('Router'));
         echo '</pre>';
     } else {
         $code = $exception->getCode();
         $message = nl2br($exception->getMessage());
         /*
                     如果错误码"可能为"合法的http状态码则尝试设置,
                     setStatus()方法会忽略非法的http状态码. */
         if ($code >= 400 && $code <= 505 && !headers_sent()) {
             ResponseModule::setStatus($code);
         }
         $var_list = array('message' => $message, 'code' => $code, 'file' => $exception->getFile(), 'url' => Singleton::getInstance('Router')->getUrl());
         if ($error_file = self::_getErrorFilePath($code)) {
             Lugit::$view = new View($var_list);
             Lugit::$view->render($error_file);
         } else {
             echo 'No error page is found.<pre>';
             print_r($var_list);
             echo '</pre>';
         }
     }
     exit;
 }
开发者ID:sujinw,项目名称:php-lugit-framework,代码行数:29,代码来源:Basic.php

示例2: __construct

 public function __construct($correlationId, Exception $exception)
 {
     parent::__construct($correlationId, null, null);
     $this->rootCause = $exception->getTraceAsString();
     $this->faultString = $exception->getMessage();
     if ($exception instanceof ServiceException) {
         $this->extendedData = $exception->getCode();
     } else {
         $this->extendedData = $exception->__toString();
     }
     $this->faultDetail = $exception->__toString();
     $this->SetError();
     $this->m_authException = $exception instanceof WebORBAuthenticationException;
 }
开发者ID:sigmadesarrollo,项目名称:logisoft,代码行数:14,代码来源:ErrMessage.php

示例3: __toString

 public function __toString()
 {
     if (class_exists('DebugException')) {
         return DebugException::Display($this, __CLASS__);
     }
     return parent::__toString();
 }
开发者ID:maxwp,项目名称:php-imap,代码行数:7,代码来源:IMAP_Exception.class.php

示例4: __toString

 public function __toString()
 {
     if (WP_DEBUG !== true) {
         return $this->friendly_msg;
     }
     return parent::__toString();
 }
开发者ID:cibulka,项目名称:cibulka-wp-plugin-forms,代码行数:7,代码来源:Form_Exception.php

示例5: catchExceptions

/**
 * Catch Exceptions
 * @param Exception $err
 */
function catchExceptions($err)
{
    global $config;
    echo "Error with your request!  Please try again later.  " . "If the problem persists contact <a href=\"" . $config['contact'] . "\">" . $config['contact'] . "</a>.";
    error_log($err->__toString(), 0);
    exit(1);
}
开发者ID:jb376,项目名称:netstat_php,代码行数:11,代码来源:netstat.php

示例6: __toString

 public function __toString()
 {
     if ($message = $this->getMessageFromResponse()) {
         return $message;
     } else {
         return parent::__toString();
     }
 }
开发者ID:mhrabovcin,项目名称:zuora-rest,代码行数:8,代码来源:ResponseException.php

示例7: __toString

 /**
  * convert the exception into a string representation.
  * if the debug is null, just return normal output.
  * if the output is printable, attach the debug as a string and return it.
  * if debug is an object and has a __toString method, go with that.
  * otherwise, the debug must be an array or some other complex structure. 
  * use print_r to represent the debug.
  */
 public function __toString()
 {
     $out = parent::__toString();
     if ($this->debug === NULL) {
         return $out;
     }
     return $out . self::DEBUG_HEADER . self::formatDebugOutput(self::stringify($this->debug));
 }
开发者ID:wukka,项目名称:exception,代码行数:16,代码来源:Exception.php

示例8: __toString

 /**
  * Override __toString() to show the response data, if available.
  *
  * @return string
  */
 public function __toString()
 {
     $string = parent::__toString();
     if ($responseData = $this->getResponseData()) {
         $string .= "\nresponse body data: " . print_r($responseData, true);
     }
     return $string;
 }
开发者ID:shootproof,项目名称:php-sdk,代码行数:13,代码来源:Sp_Exception.php

示例9: __toString

 public function __toString()
 {
     if (E_FW::get_Config('DEBUG')) {
         return parent::__toString();
     } else {
         return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
     }
 }
开发者ID:eason007,项目名称:e-fw,代码行数:8,代码来源:Core.php

示例10: handle

 /**
  * Tries to handle the exception.
  *
  * @param Exception $e
  * @return true
  */
 function handle(Exception $e)
 {
     if (!$e instanceof ErrorException || $e->getSeverity() & $this->level) {
         fwrite(STDERR, $e->__toString());
         $this->doExit($e->getCode());
     }
     return false;
 }
开发者ID:robtuley,项目名称:knotwerk,代码行数:14,代码来源:Terminal.php

示例11: __toString

 public function __toString()
 {
     // очистим всю вышестоящую буферизацию без вывода её в браузер
     !ob_get_level() ?: ob_end_clean();
     parent::__toString();
     echo joosRequest::is_ajax() ? $this->to_json() : $this->show();
     die;
 }
开发者ID:joostina,项目名称:joostina,代码行数:8,代码来源:exception.php

示例12: __toString

 public function __toString()
 {
     if (empty($this->srcFile)) {
         return parent::__toString();
     }
     $res = sprintf('From %s around line %d' . "\n", $this->srcFile, $this->srcLine);
     $res .= parent::__toString();
     return $res;
 }
开发者ID:alicam,项目名称:vanilla-theme,代码行数:9,代码来源:Exception.php

示例13: __toString

 public function __toString()
 {
     $msg = [];
     foreach ($this->deserialized as $attr => $value) {
         $msg[] = $attr . ': ' . $value;
     }
     $msg[] = 'parent message: ' . parent::__toString();
     return implode("\n", $msg);
 }
开发者ID:tempsmsru,项目名称:php-api-call,代码行数:9,代码来源:ApiCallBaseException.php

示例14: __toString

 /**
  * String representation of the exception
  *
  * @return string
  */
 public function __toString()
 {
     if (version_compare(PHP_VERSION, '5.3.0', '<')) {
         if (null !== ($e = $this->getPrevious())) {
             return $e->__toString() . "\n\nNext " . parent::__toString();
         }
     }
     return parent::__toString();
 }
开发者ID:nexces,项目名称:transys,代码行数:14,代码来源:exception.php

示例15: __toString

 /**
  * Append querylog to regular exception __toString
  * 
  * @return string String representation of the exception
  */
 public function __toString()
 {
     // Get regular message
     $toString = parent::__toString() . \PHP_EOL;
     // Append query log
     $toString .= \implode(\PHP_EOL, $this->queryLog);
     // Return String representation
     return $toString;
 }
开发者ID:janverton,项目名称:InTheCuppa,代码行数:14,代码来源:Exception.php


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