Merge "mw.Upload.BookletLayout: Add a catch all error state"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 7 Oct 2015 18:19:40 +0000 (18:19 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 7 Oct 2015 18:19:40 +0000 (18:19 +0000)
resources/src/mediawiki/mediawiki.Upload.BookletLayout.js

index b574a5d..b0c696c 100644 (file)
                                }
 
                                if ( layout.upload.getState() === mw.Upload.State.WARNING ) {
+                                       // We could get more than one of these errors, these are in order
+                                       // of importance. For example fixing the thumbnail like file name
+                                       // won't help the fact that the file already exists.
                                        if ( stateDetails.exists !== undefined ) {
                                                deferred.reject( new OO.ui.Error(
                                                        $( '<p>' ).html(
                                                                mw.message( 'badfilename', stateDetails.badfilename ).parse()
                                                        )
                                                ) );
+                                       } else {
+                                               deferred.reject( new OO.ui.Error(
+                                                       $( '<p>' ).html(
+                                                               // Let's get all the help we can if we can't pin point the error
+                                                               mw.message( 'api-error-unknown-warning', JSON.stringify( stateDetails ) ).parse()
+                                                       ),
+                                                       { recoverable: false }
+                                               ) );
                                        }
 
                                        return false;