mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-11-27 09:40:12 +00:00
Rethrow TimeoutException when using mw.language.formatDate function
timeout while converting timestamps should be a timeout for the whole parse of that wikitext and not hidden by a invalid time. Just let the exception bubble up to the caller See ca71e69f for more information Change-Id: I1f44e45dcc9b052717814990a3f5ce3a1bdf9d26
This commit is contained in:
parent
a63d074572
commit
e126de6a78
|
@ -11,6 +11,7 @@ use MediaWiki\MediaWikiServices;
|
|||
use MediaWiki\Title\Title;
|
||||
use MWTimestamp;
|
||||
use User;
|
||||
use Wikimedia\RequestTimeout\TimeoutException;
|
||||
|
||||
class LanguageLibrary extends LibraryBase {
|
||||
/** @var Language[] */
|
||||
|
@ -370,6 +371,10 @@ class LanguageLibrary extends LibraryBase {
|
|||
try {
|
||||
$utc = new DateTimeZone( 'UTC' );
|
||||
$dateObject = new DateTime( $date, $utc );
|
||||
} catch ( TimeoutException $ex ) {
|
||||
// Unfortunately DateTime throws a generic Exception, but we can't
|
||||
// ignore an exception generated by the RequestTimeout library.
|
||||
throw $ex;
|
||||
} catch ( Exception $ex ) {
|
||||
throw new LuaError( "bad argument #2 to 'formatDate': invalid timestamp '$date'" );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue