mw.Upload.BookletLayout: Add a catch all error state
authorPrateek Saxena <prtksxna@gmail.com>
Tue, 6 Oct 2015 08:08:03 +0000 (13:38 +0530)
committerPrateek Saxena <prtksxna@gmail.com>
Tue, 6 Oct 2015 08:08:03 +0000 (13:38 +0530)
Bug: T114130
Change-Id: I6d74c8bb878d6364228838df1c060fcb77ebf3e6

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;