本文整理汇总了PHP中ErrorException::getLine方法的典型用法代码示例。如果您正苦于以下问题:PHP ErrorException::getLine方法的具体用法?PHP ErrorException::getLine怎么用?PHP ErrorException::getLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ErrorException
的用法示例。
在下文中一共展示了ErrorException::getLine方法的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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
}
示例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());
}
示例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());
}
示例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()]);
}
示例10: applyErrorThrowableInfo
private static function applyErrorThrowableInfo(ThrowableInfo $throwableInfo, \ErrorException $e)
{
if (null !== ($filePath = $e->getFile())) {
$throwableInfo->addCodeInfo(self::createCodeInfo($filePath, $e->getLine()));
}
}
示例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);
}
示例12: handleFatalError
/**
* @param \ErrorException $exception
*/
protected function handleFatalError($exception)
{
\Rollbar::report_php_error($exception->getCode(), $exception->getMessage(), $exception->getFile(), $exception->getLine());
parent::handleException($exception);
}
示例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());
}
示例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>';
}
}
}
}