Catch exceptions thrown by restbase

Display the error message on the screen,
but do not throw an exception.
The extension will be available from the error log.

Bug: T134652
Change-Id: I5e88e74df6cd534d138d65251615066bab663368
This commit is contained in:
physikerwelt 2016-05-10 09:45:26 -04:00 committed by Moritz Schubotz
parent ea01eba2ae
commit a5ddbd031d

View file

@ -79,28 +79,39 @@ class MathMathML extends MathRenderer {
* @see MathRenderer::render()
*/
public function render( $forceReRendering = false ) {
if ( in_array( $this->inputType, $this->restbaseInputTypes ) && $this->mode == 'mathml' ) {
if ( !$this->rbi ){
$this->rbi = new MathRestbaseInterface( $this->getTex(), $this->getInputType() );
global $wgMathFullRestbaseURL;
try {
if ( in_array( $this->inputType, $this->restbaseInputTypes ) &&
$this->mode == 'mathml'
) {
if ( !$this->rbi ) {
$this->rbi =
new MathRestbaseInterface( $this->getTex(), $this->getInputType() );
}
$rbi = $this->rbi;
if ( $rbi->getSuccess() ) {
$this->mathml = $rbi->getMathML();
$this->mathoidStyle = $rbi->getMathoidStyle();
$this->svgPath = $rbi->getFullSvgUrl();
} elseif ( $this->lastError === '' ) {
$this->doCheck();
}
$this->changed = false;
return $rbi->getSuccess();
}
$rbi = $this->rbi;
if ( $rbi->getSuccess() ) {
$this->mathml = $rbi->getMathML();
$this->mathoidStyle = $rbi->getMathoidStyle();
$this->svgPath = $rbi->getFullSvgUrl();
} elseif ( $this->lastError === '' ) {
$this->doCheck();
if ( $forceReRendering ) {
$this->setPurge( true );
}
$this->changed = false;
return $rbi->getSuccess();
if ( $this->renderingRequired() ) {
return $this->doRender();
}
return true;
} catch ( Exception $e ) {
$this->lastError = $this->getError( 'math_mathoid_error',
$wgMathFullRestbaseURL, $e->getMessage() );
LoggerFactory::getInstance( 'Math' )->error( $e->getMessage(), [ $e, $this ] );
return false;
}
if ( $forceReRendering ) {
$this->setPurge( true );
}
if ( $this->renderingRequired() ) {
return $this->doRender();
}
return true;
}
/**