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


PHP ErrorException::getMessage方法代码示例

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


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

示例1: handleErrorException

 protected function handleErrorException(\ErrorException $e)
 {
     switch ($e->getSeverity()) {
         case E_ERROR:
         case E_RECOVERABLE_ERROR:
         case E_CORE_ERROR:
         case E_COMPILE_ERROR:
         case E_USER_ERROR:
         case E_PARSE:
             $this->logger->error($e->getMessage() . $e->getTraceAsString());
             break;
         case E_WARNING:
         case E_USER_WARNING:
         case E_CORE_WARNING:
         case E_COMPILE_WARNING:
             $this->logger->warning($e->getMessage() . $e->getTraceAsString());
             break;
         case E_NOTICE:
         case E_USER_NOTICE:
             $this->logger->notice($e->getMessage() . $e->getTraceAsString());
             break;
         case E_STRICT:
         case E_DEPRECATED:
         case E_USER_DEPRECATED:
             $this->logger->info($e->getMessage() . $e->getTraceAsString());
             break;
     }
     return true;
 }
开发者ID:bafs,项目名称:booboo,代码行数:29,代码来源:LogHandler.php

示例2: 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

示例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)
 {
     $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

示例5: 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

示例6: getInstance

 /**
  * @return \Sooh\DB\Interfaces\All
  */
 public static function getInstance($arrConf_or_Index = null, $modName = null)
 {
     if (is_array($arrConf_or_Index)) {
         $conf = $arrConf_or_Index;
     } else {
         $ini = sooh_ini::getInstance();
         if ($arrConf_or_Index === null) {
             $conf = $ini->get('dbConf');
             if (isset($conf['default'])) {
                 $conf = $conf['default'];
             } elseif (is_array($conf)) {
                 $conf = current($conf);
             } else {
                 throw new \ErrorException('default dbConf not found');
             }
         } else {
             $conf = $ini->get('dbConf.' . $arrConf_or_Index);
         }
     }
     if (!isset($conf['name']) || $modName !== null) {
         if (isset($conf['dbEnums'][$modName])) {
             $conf['name'] = $conf['dbEnums'][$modName];
         } else {
             $conf['name'] = $conf['dbEnums']['default'];
         }
     }
     $id = self::idOfConnection($conf);
     if (empty(self::$_instances[$id])) {
         $type = $conf['type'];
         if (empty($type)) {
             $ttmp = $ini->get('dbConf');
             if (is_array($ttmp)) {
                 $ttmp = implode(',', array_keys($ttmp));
             } else {
                 $ttmp = 'EMPTY';
             }
             $err = new \ErrorException('db-config missing:' . json_encode($arrConf_or_Index) . ' current:' . $ttmp);
             error_log($err->getMessage() . "\n" . $err->getTraceAsString());
             throw $err;
         }
         $class = '\\Sooh\\DB\\Types\\' . ucfirst($type);
         //			if (!class_exists($class, false))
         //				include __DIR__ . '/' . $class . '.php';
         self::$_instances[$id] = new $class($conf);
         self::$_instances[$id]->dbConf = $conf;
         if (sooh_trace::needsWrite(__CLASS__)) {
             sooh_trace::str('create new connection[' . $id . '] of ' . json_encode($conf));
         }
     } else {
         if (sooh_trace::needsWrite(__CLASS__)) {
             sooh_trace::str('exists connection[' . $id . '] of ' . json_encode($conf));
         }
     }
     return self::$_instances[$id];
 }
开发者ID:hillstill,项目名称:sooh,代码行数:58,代码来源:Broker.php

示例7: 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

示例8: 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

示例9: shutdownCheck

 public static function shutdownCheck()
 {
     //error_log("shutdown check");
     if ($error = error_get_last()) {
         if ($error['type'] == E_COMPILE_ERROR) {
             $exception = new ErrorException($error['message'], 0, $error['type'], $error['file'], $error['line']);
             if (strpos($exception->getMessage(), "Cannot redeclare class") !== false) {
                 //send email alerts for duplicate class declarations.. error already logged by php
                 $ErrorHandler = new ErrorHandler($exception);
                 $ErrorHandler->email_alert();
             }
         }
     }
     return;
 }
开发者ID:htmlgraphic,项目名称:HTMLgraphic-MVC,代码行数:15,代码来源:ErrorHandler.class.inc.php

示例10: append

 public function append($k, $v = null, $ifRealAppend = 'throwError')
 {
     if ($this->dbClass == null) {
         throw new \ErrorException('thisWhere ended already');
     }
     if ($ifRealAppend === false) {
         return $this;
     }
     $bakTb = $this->dbClass->_tmpObj($this->forTable);
     if (empty($v) && is_array($v)) {
         if ($ifRealAppend === 'markEmptyArray') {
             $this->_emptyWhere[] = $k;
             return $this;
         } else {
             $err = new \ErrorException('empty Array was Found when build where');
             error_log($err->getMessage() . "\n" . $err->getTraceAsString());
             throw $err;
         }
     }
     if (is_array($k)) {
         foreach ($k as $i => $v) {
             if (is_numeric($i)) {
                 $this->append(null, $v);
             } else {
                 $this->append($i, $v);
             }
         }
     } elseif (is_null($k)) {
         if (is_scalar($v)) {
             $err = new \ErrorException();
             error_log("should avoid:where->append(null,'sql-statement')\n" . $err->getTraceAsString());
             $this->r[] = $v;
         } else {
             $tmp = trim($v->end());
             if (!empty($tmp)) {
                 $tmp = '(' . substr($tmp, 6) . ')';
             }
             $this->r[] = $tmp;
         }
     } else {
         $this->r[] = $this->conv($k, $v);
     }
     $this->dbClass->_tmpObj($bakTb);
     return $this;
 }
开发者ID:hillstill,项目名称:sooh,代码行数:45,代码来源:Where.php

示例11: handleWrite

 public function handleWrite()
 {
     $error = null;
     set_error_handler(function ($errno, $errstr, $errfile, $errline) use(&$error) {
         $error = array('message' => $errstr, 'number' => $errno, 'file' => $errfile, 'line' => $errline);
     });
     $sent = fwrite($this->stream, $this->data);
     restore_error_handler();
     // Only report errors if *nothing* could be sent.
     // Any hard (permanent) error will fail to send any data at all.
     // Sending excessive amounts of data will only flush *some* data and then
     // report a temporary error (EAGAIN) which we do not raise here in order
     // to keep the stream open for further tries to write.
     // Should this turn out to be a permanent error later, it will eventually
     // send *nothing* and we can detect this.
     if ($sent === 0 || $sent === false) {
         if ($error === null) {
             $error = new \RuntimeException('Send failed');
         } else {
             $error = new \ErrorException($error['message'], 0, $error['number'], $error['file'], $error['line']);
         }
         $this->emit('error', array(new \RuntimeException('Unable to write to stream: ' . $error->getMessage(), 0, $error), $this));
         return;
     }
     $exceeded = isset($this->data[$this->softLimit - 1]);
     $this->data = (string) substr($this->data, $sent);
     // buffer has been above limit and is now below limit
     if ($exceeded && !isset($this->data[$this->softLimit - 1])) {
         $this->emit('drain', array($this));
     }
     // buffer is now completely empty (and not closed already)
     if ($this->data === '' && $this->listening) {
         $this->loop->removeWriteStream($this->stream);
         $this->listening = false;
         $this->emit('full-drain', array($this));
     }
 }
开发者ID:reactphp,项目名称:stream,代码行数:37,代码来源:Buffer.php

示例12: onError

 /**
  * 当调用run()时,如果抛出异常,则调用此方法处理异常(设置最后状态,返回算执行成功还是算执行失败)
  * @param \ErrorException $e
  * @return boolean
  */
 public function onError(\ErrorException $e)
 {
     $this->lastMsg = "[Error]" . $e->getMessage();
     return false;
 }
开发者ID:hillstill,项目名称:sooh,代码行数:10,代码来源:Register.php

示例13: 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

示例14: error_report

function error_report(ErrorException $e)
{
    echo 'Message:' . $e->getMessage() . "<br />";
    $trace = $e->getTrace();
}
开发者ID:hanyuwei70,项目名称:VCBS-Sub,代码行数:5,代码来源:error_report.php

示例15: createFromPHPError

 /**
  * @param \ErrorException $e
  * @return array
  */
 public static function createFromPHPError(\ErrorException $e)
 {
     return ['message' => $e->getMessage(), 'severity' => $e->getSeverity(), 'trace' => self::toSafeTrace($e->getTrace())];
 }
开发者ID:webonyx,项目名称:graphql-php,代码行数:8,代码来源:FormattedError.php


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