mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUG Exception handling and email notification mechanism now correctly considers the stacktrace as provided by the exceptionHandler function, instead of attempting to perform a debug_backtrace further down the reporting chain (which ends up generating an unnecessarily nested stacktrace). Debug was cleaned up so that errorHandler and exceptionHandler both act consistently. As a result, the LogErrorEmailFormatter class could be simplified.
This was required to fix a bug in which exceptions would not have a visible stacktrace when handled by the email logger.
This commit is contained in:
parent
9ac3cde00b
commit
f5749795a1
@ -698,13 +698,13 @@ function errorHandler($errno, $errstr, $errfile, $errline) {
|
||||
case E_ERROR:
|
||||
case E_CORE_ERROR:
|
||||
case E_USER_ERROR:
|
||||
Debug::fatalHandler($errno, $errstr, $errfile, $errline, null);
|
||||
Debug::fatalHandler($errno, $errstr, $errfile, $errline, debug_backtrace());
|
||||
break;
|
||||
|
||||
case E_WARNING:
|
||||
case E_CORE_WARNING:
|
||||
case E_USER_WARNING:
|
||||
Debug::warningHandler($errno, $errstr, $errfile, $errline, null);
|
||||
Debug::warningHandler($errno, $errstr, $errfile, $errline, debug_backtrace());
|
||||
break;
|
||||
|
||||
case E_NOTICE:
|
||||
@ -712,7 +712,7 @@ function errorHandler($errno, $errstr, $errfile, $errline) {
|
||||
case E_DEPRECATED:
|
||||
case E_USER_DEPRECATED:
|
||||
case E_STRICT:
|
||||
Debug::noticeHandler($errno, $errstr, $errfile, $errline, null);
|
||||
Debug::noticeHandler($errno, $errstr, $errfile, $errline, debug_backtrace());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -41,11 +41,8 @@ class SS_LogErrorEmailFormatter implements Zend_Log_Formatter_Interface {
|
||||
$data .= "<p style=\"color: white; background-color: $colour; margin: 0\">"
|
||||
. "[$errorType] $errstr<br />$errfile:$errline\n<br />\n<br />\n</p>\n";
|
||||
|
||||
// Get a backtrace, filtering out debug method calls
|
||||
$data .= SS_Backtrace::backtrace(true, false, array(
|
||||
'SS_LogErrorEmailFormatter->format',
|
||||
'SS_LogEmailWriter->_write'
|
||||
));
|
||||
// Render the provided backtrace
|
||||
$data .= SS_Backtrace::get_rendered_backtrace($errcontext);
|
||||
|
||||
// Compile extra data
|
||||
$blacklist = array('message', 'timestamp', 'priority', 'priorityName');
|
||||
|
Loading…
x
Reference in New Issue
Block a user