Return HTTP 429 when thumbnailing is throttled due to too many errors

Bug: T110109
Change-Id: I8af527661a041964690faae7566fb97e305e2b0f
This commit is contained in:
Gergő Tisza 2015-08-26 14:18:54 -07:00
parent 859d6bf2bc
commit 8d52a21598

View file

@ -332,6 +332,9 @@ function wfStreamThumb( array $params ) {
$errorCode = 500;
if ( !$thumb ) {
$errorMsg = $errorMsg ?: $msg->rawParams( 'File::transform() returned false' )->escaped();
if ( $errorMsg instanceof MessageSpecifier && $errorMsg->getKey() === 'thumbnail_image-failure-limit' ) {
$errorCode = 429;
}
} elseif ( $thumb->isError() ) {
$errorMsg = $thumb->getHtmlMsg();
} elseif ( !$thumb->hasFile() ) {