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


PHP ErrorException::getFile方法代码示例

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


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

示例1: handleErrorException

 public function handleErrorException(\ErrorException $exception)
 {
     $message = sprintf('%s: %s in %s:%d', $this->errorCodeName($exception->getCode()), $exception->getMessage(), $exception->getFile(), $exception->getLine());
     $exception_trace = $exception->getTraceAsString();
     $exception_trace = substr($exception_trace, strpos($exception_trace, PHP_EOL) + 1);
     $message .= PHP_EOL . $exception_trace;
     $this->save($message);
 }
开发者ID:buglloc,项目名称:php-fatal-handler,代码行数:8,代码来源:handler.php

示例2: handleErrors

 public function handleErrors(\ErrorException $e)
 {
     $severity = $this->determineSeverityTextValue($e->getSeverity());
     $type = 'Error (' . $severity . ')';
     $message = $e->getMessage();
     $file = $e->getFile();
     $line = $e->getLine();
     return $this->getHtml($type, $message, $file, $line);
 }
开发者ID:bafs,项目名称:booboo,代码行数:9,代码来源:HtmlPrettyFormatter.php

示例3: handleErrors

 public function handleErrors(\ErrorException $e)
 {
     $severity = $this->determineSeverityTextValue($e->getSeverity());
     $message = $e->getMessage();
     $file = $e->getFile();
     $line = $e->getLine();
     $error = ['message' => $message, 'severity' => $severity, 'file' => $file, 'line' => $line];
     return $error;
 }
开发者ID:schpill,项目名称:standalone,代码行数:9,代码来源:JsonFormatter.php

示例4: handleErrors

 public function handleErrors(\ErrorException $e)
 {
     $errorString = "<strong>%s</strong>: %s in <strong>%s</strong> on line <strong>%d</strong>";
     $severity = $this->determineSeverityTextValue($e->getSeverity());
     $error = $e->getMessage();
     $file = $e->getFile();
     $line = $e->getLine();
     $error = sprintf($errorString, $severity, $error, $file, $line);
     return $this->getTable($error);
 }
开发者ID:schpill,项目名称:standalone,代码行数:10,代码来源:HtmlTableFormatter.php

示例5: handleErrors

 public function handleErrors(\ErrorException $e)
 {
     $errorString = "%s%s in %s on line %d\n";
     $severity = $this->determineSeverityTextValue($e->getSeverity());
     // Let's calculate the length of the box, and set the box border.
     $dashes = "\n+" . str_repeat('-', strlen($severity) + 2) . "+\n";
     $severity = $dashes . '| ' . strtoupper($severity) . " |" . $dashes;
     // Okay, now let's prep the message components.
     $error = $e->getMessage();
     $file = $e->getFile();
     $line = $e->getLine();
     $error = sprintf($errorString, $severity, $error, $file, $line);
     return $error;
 }
开发者ID:schpill,项目名称:standalone,代码行数:14,代码来源:CommandLineFormatter.php

示例6: exceptionHandler

 /**
  * @param \Throwable $exception
  */
 public static function exceptionHandler(\Throwable $exception)
 {
     // This error code is not included in error_reporting
     if (!error_reporting() || $exception->getLine() == 0) {
         return;
     }
     $output = new ConsoleOutput(OutputInterface::VERBOSITY_VERY_VERBOSE);
     if (!$exception instanceof \Exception) {
         $exception = new \ErrorException($exception->getMessage(), $exception->getCode(), 0, $exception->getFile(), $exception->getLine(), $exception);
         self::$application->renderException($exception, $output);
     } else {
         self::$application->renderException($exception, $output);
     }
 }
开发者ID:cawaphp,项目名称:cawa,代码行数:17,代码来源:ConsoleApp.php

示例7: __construct

 public function __construct($message, \ErrorException $previous)
 {
     parent::__construct($message, $previous->getCode(), $previous->getSeverity(), $previous->getFile(), $previous->getLine(), $previous->getPrevious());
     $this->setTrace($previous->getTrace());
 }
开发者ID:Ener-Getick,项目名称:symfony,代码行数:5,代码来源:UndefinedFunctionException.php

示例8: getFrameFromError

 /**
  * Given an error, generates an array in the format
  * generated by ErrorException
  * @param  ErrorException $exception
  * @return array
  */
 protected function getFrameFromError(ErrorException $exception)
 {
     return array('file' => $exception->getFile(), 'line' => $exception->getLine(), 'class' => null, 'args' => array());
 }
开发者ID:kenarkose,项目名称:meltdown,代码行数:10,代码来源:Inspector.php

示例9: consoleErrorException

 /**
  * Log error exceptions to user console using JSON_Response::error
  *
  * @param ErrorException $err_exc The error exception
  * @return void
  * @uses JSON_Response
  */
 public function consoleErrorException(\ErrorException $err_exc)
 {
     Core\JSON_Response::load()->error(['message' => $err_exc->getMessage(), 'code' => $err_exc->getCode(), 'severity' => $err_exc->getSeverity(), 'line' => $err_exc->getLine(), 'file' => $err_exc->getFile(), 'trace' => $err_exc->getTrace()]);
 }
开发者ID:shgysk8zer0,项目名称:core,代码行数:11,代码来源:errors.php

示例10: applyErrorThrowableInfo

 private static function applyErrorThrowableInfo(ThrowableInfo $throwableInfo, \ErrorException $e)
 {
     if (null !== ($filePath = $e->getFile())) {
         $throwableInfo->addCodeInfo(self::createCodeInfo($filePath, $e->getLine()));
     }
 }
开发者ID:n2n,项目名称:n2n,代码行数:6,代码来源:ThrowableInfoFactory.php

示例11: onNotSuccessfulTest

 /**
  * {@inheritdoc}
  */
 protected function onNotSuccessfulTest(\Exception $e)
 {
     if (!in_array(get_class($e), array('PHPUnit_Framework_IncompleteTestError', 'PHPUnit_Framework_SkippedTestError'))) {
         $e = new \ErrorException($e->getMessage() . "\nScreenshot: " . $this->makeScreenshot(), $e->getCode(), 0, $e->getFile(), $e->getLine() - 1, $e);
     }
     parent::onNotSuccessfulTest($e);
 }
开发者ID:usetreno,项目名称:JsFormValidatorBundle,代码行数:10,代码来源:BaseMinkTestCase.php

示例12: handleFatalError

 /**
  * @param \ErrorException $exception
  */
 protected function handleFatalError($exception)
 {
     \Rollbar::report_php_error($exception->getCode(), $exception->getMessage(), $exception->getFile(), $exception->getLine());
     parent::handleException($exception);
 }
开发者ID:metalguardian,项目名称:yii-ratchet-error-handler,代码行数:8,代码来源:ErrorHandler.php

示例13: formatErrorException

 /**
  * Format an \ErrorException into a string destined for PHP error_log()
  *
  * @access private
  * @param \ErrorException $exception The error exception to format
  * @return string The formatted error message
  */
 function formatErrorException($exception)
 {
     if (!$exception instanceof \ErrorException) {
         return '';
     }
     $errorType = '';
     $errorCode = $exception->getCode();
     // Find an error type based on the error code
     switch ($errorCode) {
         case $errorCode & (E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR):
             $errorType = 'PHP Fatal error';
             break;
         case $errorCode & (E_NOTICE | E_USER_NOTICE):
             $errorType = 'PHP Notice';
             break;
         case $errorCode & (E_WARNING | E_CORE_WARNING | E_COMPILE_WARNING | E_USER_WARNING):
             $errorType = 'PHP Warning';
             break;
         case $errorCode & (E_DEPRECATED | E_USER_DEPRECATED):
             $errorType = 'PHP Deprecated';
             break;
         case $errorCode & E_PARSE:
             $errorType = 'PHP Parse error';
             break;
         case $errorCode & E_STRICT:
             $errorType = 'PHP Strict standards';
             break;
     }
     return formatPHPErrorLog($exception->getMessage(), $errorType, $exception->getFile(), $exception->getLine());
 }
开发者ID:vanilla,项目名称:vanilla,代码行数:37,代码来源:functions.error.php

示例14: shutdown

 public static function shutdown()
 {
     $isError = false;
     if ($error = error_get_last()) {
         switch ($error['type']) {
             case E_ERROR:
                 // 1
             // 1
             case E_CORE_ERROR:
                 // 16
             // 16
             case E_COMPILE_ERROR:
                 // 64
             // 64
             case E_USER_ERROR:
                 //256
             //256
             case E_PARSE:
                 //4
                 $isError = true;
                 break;
             case E_WARNING:
                 //2
             //2
             case E_NOTICE:
                 //8
             //8
             case E_CORE_WARNING:
                 //32
             //32
             case E_COMPILE_WARNING:
                 //128
             //128
             case E_USER_WARNING:
                 //512
             //512
             case E_USER_NOTICE:
                 //1024
             //1024
             case E_STRICT:
                 //2048
                 break;
         }
     }
     if ($isError) {
         http_response_code(500);
         $guid = false;
         try {
             $e = new ErrorException($error['message'], 0, 1, $error['file'], $error['line']);
             //$guid = Dfi_Error_Report::saveException($e);
         } catch (Exception $e) {
             $guid = false;
         }
         if (!preg_match('/cli/', php_sapi_name())) {
             Zend_Registry::get('shutdownLogger')->log($error['message'] . ' : ' . $error['file'] . ' : (' . $error['line'] . ')', Zend_Log::CRIT);
             if (!Dfi_App_Config::get('main.showDebug')) {
                 $url = "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s://" : "://") . $_SERVER['HTTP_HOST'] . '/';
                 header("Location: " . $url . "error/error" . ($guid ? '/guid/' . $guid : ''));
                 exit;
             } else {
                 ob_clean();
                 echo '<pre>REPORT: ' . ($guid ? $guid : 'brak') . "\n";
                 echo 'REQUEST: ' . (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '') . "\n";
                 echo 'REFERER: ' . (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '') . "\n";
                 echo 'ERROR: ' . $e->getMessage() . ' : ' . $e->getFile() . ' : (' . $e->getLine() . ')' . "\n" . $e->getTraceAsString() . '</pre>';
             }
         }
     }
 }
开发者ID:dafik,项目名称:dfi,代码行数:69,代码来源:Handler.php


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