本文整理汇总了PHP中MWException::report方法的典型用法代码示例。如果您正苦于以下问题:PHP MWException::report方法的具体用法?PHP MWException::report怎么用?PHP MWException::report使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MWException
的用法示例。
在下文中一共展示了MWException::report方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: report
/**
* Overrides MWException::report to also write exceptions to error_log
*
* @see MWException::report
*/
function report()
{
$file = $this->getFile();
$line = $this->getLine();
$message = $this->getMessage();
$request = RequestContext::getMain()->getRequest();
$url = '[no URL]';
if (isset($request)) {
$url = $request->getFullRequestURL();
}
trigger_error("Exception from line {$line} of {$file}: {$message} ({$url})", E_USER_ERROR);
/*
bust the headers_sent check in MWException::report()
Uncomment to override normal MWException headers
in order to display an error page instead of a 500 error
WARNING: Varnish doesn't like those
flush();
*/
parent::report();
}
示例2: report
/**
* Override MWException report() and write exceptions to error_log
*
* Uncomment the flush() line to override normal MWException headers
* so we can display an error page instead of a 500 error (varnish doesn't like those)
*
* TODO: display a nice walter?
*/
function report()
{
global $wgRequest;
$file = $this->getFile();
$line = $this->getLine();
$message = $this->getMessage();
$url = '[no URL]';
if (isset($wgRequest)) {
$url = $wgRequest->getFullRequestURL();
}
trigger_error("Exception from line {$line} of {$file}: {$message} ({$url})", E_USER_ERROR);
//flush(); // bust the headers_sent check in MWException::report()
parent::report();
}