silverstripe-cms/code/logging/ErrorPageErrorFormatter.php

29 lines
637 B
PHP
Raw Normal View History

<?php
namespace SilverStripe\Cms\Logging;
use ErrorPage;
use SilverStripe\Framework\Logging\DebugViewFriendlyErrorFormatter;
/**
* Provides {@see ErrorPage}-gnostic error handling
*/
class ErrorPageErrorFormatter extends DebugViewFriendlyErrorFormatter {
2016-03-08 21:50:55 +01:00
public function output($statusCode) {
// Ajax content is plain-text only
if(\Director::is_ajax()) {
return $this->getTitle();
}
2016-03-08 21:50:55 +01:00
// Determine if cached ErrorPage content is available
$content = ErrorPage::get_content_for_errorcode($statusCode);
if($content) {
return $content;
}
// Fallback to default output
return parent::output($statusCode);
}
}