/** * Constructor. * @param integer HTTP status code, such as 404, 500, etc. * @param string error message. This can be a string that is listed * in the message file. If so, the message in the preferred language * will be used as the error message. Any rest parameters will be used * to replace placeholders ({0}, {1}, {2}, etc.) in the message. */ public function __construct($statusCode, $errorMessage) { $this->_statusCode = $statusCode; $this->setErrorCode($errorMessage); $errorMessage = $this->translateErrorMessage($errorMessage); $args = func_get_args(); array_shift($args); array_shift($args); $n = count($args); $tokens = array(); for ($i = 0; $i < $n; ++$i) { $tokens['{' . $i . '}'] = TPropertyValue::ensureString($args[$i]); } parent::__construct(strtr($errorMessage, $tokens)); }
/** * Constructor. * @param integer error number * @param string error string * @param string error file * @param integer error line number */ public function __construct($errno, $errstr, $errfile, $errline) { static $errorTypes = array(E_ERROR => "Error", E_WARNING => "Warning", E_PARSE => "Parsing Error", E_NOTICE => "Notice", E_CORE_ERROR => "Core Error", E_CORE_WARNING => "Core Warning", E_COMPILE_ERROR => "Compile Error", E_COMPILE_WARNING => "Compile Warning", E_USER_ERROR => "User Error", E_USER_WARNING => "User Warning", E_USER_NOTICE => "User Notice", E_STRICT => "Runtime Notice"); $errorType = isset($errorTypes[$errno]) ? $errorTypes[$errno] : 'Unknown Error'; parent::__construct("[{$errorType}] {$errstr} (@line {$errline} in file {$errfile})."); }
/** * Constructor. * @param integer $errno error number * @param string $errstr error string * @param string $errfile error file * @param integer $errline error line number */ public function __construct($errno, $errstr, $errfile, $errline) { static $errorTypes = array(E_ERROR => 'Error', E_WARNING => 'Warning', E_PARSE => 'Parsing Error', E_NOTICE => 'Notice', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice'); $errorType = isset($errorTypes[$errno]) ? $errorTypes[$errno] : 'Unknown Error'; parent::__construct(sPrintF('[%s] %s (@line %d in file %s)', $errorType, $errstr, $errline, $errfile)); }