silverstripe-cms/code/controllers/ErrorPageControllerExtension.php
2015-09-29 17:18:03 +13:00

18 lines
395 B
PHP

<?php
/**
* Enhances error handling for a controller with ErrorPage generated output
*
* @package cms
* @subpackage controller
*/
class ErrorPageControllerExtension extends Extension {
public function onBeforeHTTPError($statusCode, $request) {
$response = ErrorPage::response_for($statusCode);
if($response) {
throw new SS_HTTPResponse_Exception($response, $statusCode);
}
}
}