Bartosz Dziewoński has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/260583

Change subject: mw.Upload.BookletLayout: Don't explode when the API call fails 
with 'exception'
......................................................................

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
---
M resources/src/mediawiki/mediawiki.Upload.BookletLayout.js
1 file changed, 8 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/83/260583/1

diff --git a/resources/src/mediawiki/mediawiki.Upload.BookletLayout.js 
b/resources/src/mediawiki/mediawiki.Upload.BookletLayout.js
index 54f3ab6..2ef3e87 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(
+                                       $( '<p>' ).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' ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/260583
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9b9d5df5bf0db67a4d2fcc97fb886dc3c9519d5a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to