cakephpで例外をハンドリングする

ディスパッチャーを修正

[cakephpインストールディレクトリ]/cake/dispatcher.php


$output = $controller->dispatchMethod($params['action'], $params['pass']);

↓のように修正

try {

$output = $controller->dispatchMethod($params['action'], $params['pass']);

} catch (Exception $e) {

$this->log($e->getMessage(), LOG_ERROR);
$controller->layout = "app_error";
}

0 コメント: