public function __construct($message = '', $data = array()) { parent::__construct($message, 500, $data); }
function _hx_error_handler($errno, $errmsg, $filename, $linenum, $vars) { if (!(error_reporting() & $errno)) { return false; } $msg = $errmsg . ' (errno: ' . $errno . ') in ' . $filename . ' at line #' . $linenum; $e = new HException($msg, $errmsg, $errno, _hx_anonymous(array('fileName' => 'Boot.hx', 'lineNumber' => __LINE__, 'className' => 'php.Boot', 'methodName' => '_hx_error_handler'))); $e->setFile($filename); $e->setLine($linenum); throw $e; return null; }
/** * 异常处理 * @param HException $exception */ public function handleException($exception) { $code = $exception->getCode(); //服务器错误 if ($code == 500) { Controller::renderErr($exception->getMessage(), $exception->getFile(), $exception->getLine(), $exception->data); } elseif ($this->_h_config['is_log']) { $log = 'Exception Code[' . $code . '] Msg[' . $exception->getMessage() . '] ' . $exception->getFile() . ' on line ' . $exception->getLine(); HLog::model()->add($log, HLog::LEVEL_ERROR); HLog::model()->save(); } }