$cache->set( $key, $result );
} catch ( Exception $exception ) {
// Return exception as a comment
- $result = "/*\n{$exception->__toString()}\n*/";
+ $result = "/*\n{$exception->__toString()}\n*/\n";
}
wfProfileOut( __METHOD__ );
ob_start();
wfProfileIn( __METHOD__ );
- $response = '';
+ $exceptions = '';
// Split requested modules into two groups, modules and missing
$modules = array();
$this->preloadModuleInfo( array_keys( $modules ), $context );
} catch( Exception $e ) {
// Add exception to the output as a comment
- $response .= "/*\n{$e->__toString()}\n*/";
+ $exceptions .= "/*\n{$e->__toString()}\n*/\n";
}
wfProfileIn( __METHOD__.'-getModifiedTime' );
$mtime = max( $mtime, $module->getModifiedTime( $context ) );
} catch ( Exception $e ) {
// Add exception to the output as a comment
- $response .= "/*\n{$e->__toString()}\n*/";
+ $exceptions .= "/*\n{$e->__toString()}\n*/\n";
}
}
}
// Generate a response
- $response .= $this->makeModuleResponse( $context, $modules, $missing );
+ $response = $this->makeModuleResponse( $context, $modules, $missing );
+
+ // Prepend comments indicating exceptions
+ $response = $exceptions . $response;
// Capture any PHP warnings from the output buffer and append them to the
// response in a comment if we're in debug mode.
if ( $context->getDebug() && strlen( $warnings = ob_get_contents() ) ) {
- $response .= "/*\n$warnings\n*/";
+ $response = "/*\n$warnings\n*/\n" . $response;
}
// Remove the output buffer and output the response
array $modules, $missing = array() )
{
$out = '';
+ $exceptions = '';
if ( $modules === array() && $missing === array() ) {
return '/* No modules requested. Max made me put this here */';
}
// Pre-fetch blobs
if ( $context->shouldIncludeMessages() ) {
- //try {
+ try {
$blobs = MessageBlobStore::get( $this, $modules, $context->getLanguage() );
- //} catch ( Exception $e ) {
+ } catch ( Exception $e ) {
// Add exception to the output as a comment
- // $out .= "/*\n{$e->__toString()}\n*/";
- //}
+ $exceptions .= "/*\n{$e->__toString()}\n*/\n";
+ }
} else {
$blobs = array();
}
}
} catch ( Exception $e ) {
// Add exception to the output as a comment
- $out .= "/*\n{$e->__toString()}\n*/";
+ $exceptions .= "/*\n{$e->__toString()}\n*/\n";
// Register module as missing
$missing[] = $name;
}
if ( $context->getDebug() ) {
- return $out;
+ return $exceptions . $out;
} else {
if ( $context->getOnly() === 'styles' ) {
- return $this->filter( 'minify-css', $out );
+ return $exceptions . $this->filter( 'minify-css', $out );
} else {
- return $this->filter( 'minify-js', $out );
+ return $exceptions . $this->filter( 'minify-js', $out );
}
}
}