エラー画面のカスタマイズ

メモ書き

app/Config/core.php

・
(前略)
・
	Configure::write('Exception', array(
		'handler' => 'ErrorHandler::handleException',
		'renderer' => 'AppExceptionRenderer',
		'log' => true
	));
・
(後略)
・

app/Lib/Error/AppExceptionRenderer.php

<?php
App::uses('ExceptionRenderer', 'Error');

class AppExceptionRenderer extends ExceptionRenderer {
	protected function _getController($exception) {
		$controller = parent::_getController($exception);
		$controller->layout = 'error';
		return $controller;
	}
}

後は、

layoutを変更したければ、
app/View/Layout/error.ctp
を編集すればよいし、

contentを変更したければ、
app/View/Errors/error400.ctp
app/View/Errors/error500.ctp
あたりを編集すればよい。

参考:
http://book.cakephp.org/2.0/en/development/exceptions.html

以上