|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2009-2011 Ingo Renner <ingo@typo3.org> 00006 * All rights reserved 00007 * 00008 * This script is part of the TYPO3 project. The TYPO3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * 00017 * This script is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * This copyright notice MUST APPEAR in all copies of the script! 00023 ***************************************************************/ 00024 00025 00026 /** 00027 * A quite exception handler which catches but ignores any exception. 00028 * 00029 * This file is a backport from FLOW3 00030 * 00031 * @package TYPO3 00032 * @subpackage t3lib_error 00033 * @version $Id: class.t3lib_error_productionexceptionhandler.php 10121 2011-01-18 20:15:30Z ohader $ 00034 */ 00035 class t3lib_error_ProductionExceptionHandler extends t3lib_error_AbstractExceptionHandler { 00036 00037 /** 00038 * Constructs this exception handler - registers itself as the default exception handler. 00039 * 00040 * @author Robert Lemke <robert@typo3.org> 00041 */ 00042 public function __construct() { 00043 set_exception_handler(array($this, 'handleException')); 00044 } 00045 00046 /** 00047 * Echoes an exception for the web. 00048 * 00049 * @param Exception $exception The exception 00050 * @return void 00051 */ 00052 public function echoExceptionWeb(Exception $exception) { 00053 if (!headers_sent()) { 00054 header("HTTP/1.1 500 Internal Server Error"); 00055 } 00056 $this->writeLogEntries($exception, self::CONTEXT_WEB); 00057 // we use a nice-looking title for our visitors instead of the exception's class name 00058 $messageObj = t3lib_div::makeInstance('t3lib_message_ErrorPageMessage', $exception->getMessage(), 'Oops, an error occured!'); 00059 $messageObj->output(); 00060 } 00061 00062 /** 00063 * Echoes an exception for the command line. 00064 * 00065 * @param Exception $exception The exception 00066 * @return void 00067 */ 00068 public function echoExceptionCLI(Exception $exception) { 00069 $this->writeLogEntries($exception, self::CONTEXT_CLI); 00070 exit(1); 00071 } 00072 } 00073 00074 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/error/class.t3lib_error_productionexceptionhandler.php'])) { 00075 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/error/class.t3lib_error_productionexceptionhandler.php']); 00076 } 00077 00078 ?>
1.8.0