/** * Construction of the exception - a message is needed (1st argument) * * @param string $message The exception message * @param numeric $code The exception code * @param misc $previous The previous exception if so */ public function __construct($message, $code = 0, $previous = null) { // We let the default PHP Exception manager construction parent::__construct($message, $code, $previous); $this->trace = parent::getTrace(); $this->previous = parent::getPrevious(); if (isset($php_errormsg)) { $this->php_error_message = $php_errormsg; } $dom_id = Profiler::getNewDomId('exception'); $this->infos = array('message' => self::_buildExceptionStr(), 'type' => 'exception', 'scope' => 'Exception', 'file' => $this->getFile(), 'line' => $this->getLine(), 'filename' => basename($this->getFile()), 'dirname' => dirname($this->getFile()), 'dom_id' => $dom_id, 'source' => Profiler::getHighlightedSource($this->getFile(), $this->getLine())); $this->infos['traces'] = Profiler::getHighlightedTraces($this->getTrace(), $this->infos); $this->debugger = Debugger::getInstance(); $this->debugger->addStack('message', $this->infos); $this->debugger->setDebuggerTitle(self::_buildExceptionStr(true), Url::getRequestUrl()); }
/** * Construction of the error - a message is needed (1st argument) * * @param string $message The error message * @param numeric $code The error code * @param numeric $severity The error severity code * @param string $filename The file name of the error * @param numeric $lineno The line number of the error * @param misc $previous The previous error if so */ public function __construct($message, $code = 0, $severity = 1, $filename = __FILE__, $lineno = __LINE__, $previous = null) { // This error code is not in the error_reporting() if (!(error_reporting() & $code)) { return; } // We let the default PHP Exception manager construction parent::__construct($message, $code, $severity, $filename, $lineno, $previous); $this->trace = parent::getTrace(); $this->previous = parent::getPrevious(); if (isset($php_errormsg)) { $this->php_error_message = $php_errormsg; } switch ($this->getCode()) { case E_ERROR: case E_USER_ERROR: $this->setType('fatal'); $this->setScope('Fatal Error'); $this->exit = true; break; case E_WARNING: case E_USER_WARNING: $this->setType('warning'); $this->setScope('Warning'); break; case E_NOTICE: case E_USER_NOTICE: case @E_STRICT: $this->setType('notice'); $this->setScope('Notice'); break; case @E_RECOVERABLE_ERROR: $this->setType('catchable'); $this->setScope('Catchable Error'); break; case E_PARSE: $this->setType('parse'); $this->setScope('Parsing Error'); break; case @E_DEPRECATED: case @E_USER_DEPRECATED: $this->setType('deprecated'); $this->setScope('Deprecated Error'); break; default: $this->setType('unknown'); $this->setScope('Unknown Error'); $this->exit = true; break; } $dom_id = Profiler::getNewDomId($this->getType()); $this->infos = array('message' => self::_buildExceptionStr(), 'scope' => $this->getScope(), 'type' => $this->getType(), 'file' => $this->getFile(), 'line' => $this->getLine(), 'severity' => $this->getSeverity(), 'filename' => basename($this->getFile()), 'dirname' => dirname($this->getFile()), 'dom_id' => $dom_id, 'source' => Profiler::getHighlightedSource($this->getFile(), $this->getLine())); $this->infos['traces'] = Profiler::getHighlightedTraces($this->getTrace(), $this->infos); $this->debugger = Debugger::getInstance(); $this->debugger->addStack('message', $this->infos); $this->debugger->setDebuggerTitle(self::_buildExceptionStr(true), Url::getRequestUrl()); return false; }