* It will be either HTML or plain text based on isCommandLine().
*/
function report() {
- global $wgLogExceptionBacktrace, $wgMimeType;
- $log = $this->getLogMessage();
+ global $wgMimeType;
- if ( $log ) {
- if ( $wgLogExceptionBacktrace ) {
- wfDebugLog( 'exception', $log . "\n" . $this->getTraceAsString() . "\n" );
- } else {
- wfDebugLog( 'exception', $log );
- }
- }
+ $this->logException();
if ( defined( 'MW_API' ) ) {
// Unhandled API exception, we can't be sure that format printer is alive
}
}
+ /**
+ * Log the error message to the exception log (if enabled)
+ */
+ function logException() {
+ global $wgLogExceptionBacktrace;
+
+ $log = $this->getLogMessage();
+ if ( $log ) {
+ if ( $wgLogExceptionBacktrace ) {
+ wfDebugLog( 'exception', $log . "\n" . $this->getTraceAsString() . "\n" );
+ } else {
+ wfDebugLog( 'exception', $log );
+ }
+ }
+ }
+
/**
* Check whether we are in command line mode or not to report the exception
* in the correct format.
// Save filtered text to Memcached
$cache->set( $key, $result );
} catch ( Exception $exception ) {
+ $exception->logException();
wfDebugLog( 'resourceloader', __METHOD__ . ": minification failed: $exception" );
$this->hasErrors = true;
// Return exception as a comment
try {
$this->preloadModuleInfo( array_keys( $modules ), $context );
} catch ( Exception $e ) {
+ $e->logException();
wfDebugLog( 'resourceloader', __METHOD__ . ": preloading module info failed: $e" );
$this->hasErrors = true;
// Add exception to the output as a comment
// Calculate maximum modified time
$mtime = max( $mtime, $module->getModifiedTime( $context ) );
} catch ( Exception $e ) {
+ $e->logException();
wfDebugLog( 'resourceloader', __METHOD__ . ": calculating maximum modified time failed: $e" );
$this->hasErrors = true;
// Add exception to the output as a comment
try {
$blobs = MessageBlobStore::get( $this, $modules, $context->getLanguage() );
} catch ( Exception $e ) {
+ $e->logException();
wfDebugLog( 'resourceloader', __METHOD__ . ": pre-fetching blobs from MessageBlobStore failed: $e" );
$this->hasErrors = true;
// Add exception to the output as a comment
break;
}
} catch ( Exception $e ) {
+ $e->logException();
wfDebugLog( 'resourceloader', __METHOD__ . ": generating module package failed: $e" );
$this->hasErrors = true;
// Add exception to the output as a comment