TheDJ has submitted this change and it was merged.

Change subject: Better error messages.
......................................................................


Better error messages.

Displaying the error code doesn't make much sense then the info can

Example
{"error":{"code":"http-curl-error","info":"Error fetching file from remote
source","0":"couldn't connect to host"}}

Bug: 27305
Change-Id: I84641dd92581de5bb546663ec60652d60f82cf65
---
M resources/mw.UploadWizardUploadInterface.js
1 file changed, 4 insertions(+), 2 deletions(-)

Approvals:
  TheDJ: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/resources/mw.UploadWizardUploadInterface.js 
b/resources/mw.UploadWizardUploadInterface.js
index 740fc3b..43d9768 100644
--- a/resources/mw.UploadWizardUploadInterface.js
+++ b/resources/mw.UploadWizardUploadInterface.js
@@ -248,8 +248,7 @@
        showError: function( code, info ) {
                this.showIndicator( 'error' );
                // is this an error that we expect to have a message for?
-               var msgKey = 'api-error-unknown-code';
-               var args = [ code ];
+               var msgKey, args;
 
                if ( code === 'http' && info.textStatus === 'timeout' ) {
                        code = 'timeout';
@@ -261,6 +260,9 @@
                } else if ( code === 'unknown-warning' ) {
                        msgKey = 'api-error-unknown-warning';
                        args = $j.makeArray( info );
+               } else {
+                       msgKey =  = 'api-error-unknown-code';
+                       args = [code].concat( $j.makeArray( info ) );
                }
                this.setStatus( msgKey, args );
        },

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I84641dd92581de5bb546663ec60652d60f82cf65
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Nischayn22 <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: MarkTraceur <[email protected]>
Gerrit-Reviewer: Nischayn22 <[email protected]>
Gerrit-Reviewer: TheDJ <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to