Source for file ErrorHandler.php
Documentation is available at ErrorHandler.php
* Teeple2 - PHP5 Web Application Framework inspired by Seasar2
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
* @author Mitsutaka Sato <miztaka@gmail.com>
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @param Exception $e 例外クラス
public static function handle($e) {
$display =
$e->getMessage();
$template =
'common/exception.html';
$renderer->assign('display', $display);
$renderer->assign('stack', $e->__toString());
$result =
$renderer->fetch($template);
self::print_error($display);
* @param unknown_type $errno
* @param unknown_type $errmsg
* @param unknown_type $filename
* @param unknown_type $linenum
* @param unknown_type $vars
public static function handlePHPError($errno, $errmsg, $filename, $linenum, $vars) {
E_CORE_ERROR => 'E_CORE_ERROR',
E_CORE_WARNING => 'E_CORE_WARNING',
E_COMPILE_ERROR => 'E_COMPILE_ERROR',
E_USER_ERROR => 'E_USER_ERROR',
E_USER_WARNING => 'E_USER_WARNING',
E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR',
E_WARNING => 'E_WARNING',
E_COMPILE_WARNING => 'E_COMPILE_WARNING',
E_USER_NOTICE => 'E_USER_NOTICE'
// ロギング (エラー種別にあわせてレベルを代える。)
case E_RECOVERABLE_ERROR:
$log =& LoggerManager::getLogger(get_class($this));
$log->$level("[PHPError]errno={$errtype[$errno]},errmsg={$errmsg},filename={$filename},linenum={$linenum},vars=". var_export($vars, TRUE));
self::handle(new Teeple_Exception(MC::getLog(MSG_MA999), MSG_MA999));
* @param Exception $e 例外クラス。
$log =
LoggerManager::getLogger('ErrorHandler');
// メッセージとStackTraceをerrorでロギング
$log->fatal($e->getMessage());
$log->fatal("*** stack trace ***\n".
$e->__toString());
$log->fatal("*** request dump ***\n".
var_export(@$_REQUEST, TRUE));
$log->fatal("*** session dump ***\n".
var_export(@$_SESSION, TRUE));
private static function print_error($display) {
<p>
<?php echo
$display ?></p>