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
1 changed files with 30 additions and 19 deletions

View File

@ -79,9 +79,14 @@ class MathMathML extends MathRenderer {
* @see MathRenderer::render()
*/
public function render( $forceReRendering = false ) {
if ( in_array( $this->inputType, $this->restbaseInputTypes ) && $this->mode == 'mathml' ) {
global $wgMathFullRestbaseURL;
try {
if ( in_array( $this->inputType, $this->restbaseInputTypes ) &&
$this->mode == 'mathml'
) {
if ( !$this->rbi ) {
$this->rbi = new MathRestbaseInterface( $this->getTex(), $this->getInputType() );
$this->rbi =
new MathRestbaseInterface( $this->getTex(), $this->getInputType() );
}
$rbi = $this->rbi;
if ( $rbi->getSuccess() ) {
@ -101,6 +106,12 @@ class MathMathML extends MathRenderer {
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;
}
}
/**