From: Bartosz DziewoƄski Date: Tue, 22 Dec 2015 15:13:25 +0000 (+0100) Subject: mw.Upload.BookletLayout: Don't explode when the API call fails with 'exception' X-Git-Tag: 1.31.0-rc.0~8248^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmes_infos.php?a=commitdiff_plain;h=a7ab9222e975af7c9ffc49c9039abe96eb650afc;p=lhc%2Fweb%2Fwiklou.git mw.Upload.BookletLayout: Don't explode when the API call fails with 'exception' I just tried uploading a large file (~250 MB) and hit the timeout limit. Since there's no 'error' key, some of our logic broke. Change-Id: I9b9d5df5bf0db67a4d2fcc97fb886dc3c9519d5a --- diff --git a/resources/src/mediawiki/mediawiki.Upload.BookletLayout.js b/resources/src/mediawiki/mediawiki.Upload.BookletLayout.js index 54f3ab68f4..2ef3e874d3 100644 --- a/resources/src/mediawiki/mediawiki.Upload.BookletLayout.js +++ b/resources/src/mediawiki/mediawiki.Upload.BookletLayout.js @@ -286,6 +286,14 @@ warnings = stateDetails.upload && stateDetails.upload.warnings; if ( state === mw.Upload.State.ERROR ) { + if ( !error ) { + // If there's an 'exception' key, this might be a timeout, or other connection problem + return new OO.ui.Error( + $( '

' ).msg( 'api-error-unknownerror', JSON.stringify( stateDetails ) ), + { recoverable: false } + ); + } + // HACK We should either have a hook here to allow TitleBlacklist to handle this, or just have // TitleBlacklist produce sane error messages that can be displayed without arcane knowledge if ( error.info === 'TitleBlacklist prevents this title from being created' ) {