Santhosh has uploaded a new change for review. https://gerrit.wikimedia.org/r/227409
Change subject: Provide useful error details when publishing fails ...................................................................... Provide useful error details when publishing fails From our logs, we see 4 main reasons for publishing failures. 1. Timeout. Related to network. 2. spamblacklist catching URLs in translation 3. User blocked from editing. Now we are not providing Special:CX at all for this category of users 4. Parsoid failed to convert the HTML to wikitext. For all of these provide a brief hint in publishing error message. Bug: T100498 Change-Id: Ia96ec15a4d44c7c1403542bdd1e25660984fad8b --- M extension.json M i18n/en.json M i18n/qqq.json M modules/publish/ext.cx.publish.js 4 files changed, 20 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation refs/changes/09/227409/1 diff --git a/extension.json b/extension.json index c20fdb5..ea27279 100644 --- a/extension.json +++ b/extension.json @@ -631,7 +631,8 @@ "cx-publish-page-success", "cx-publish-page-error", "cx-publish-button-publishing", - "cx-publish-captcha-title" + "cx-publish-captcha-title", + "unknown-error" ] }, "ext.cx.wikibase.link": { diff --git a/i18n/en.json b/i18n/en.json index a965998..304ce59 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -28,7 +28,7 @@ "cx-header-all-translations": "All translations", "cx-source-view-page": "view page", "cx-publish-page-success": "Page published at $1", - "cx-publish-page-error": "An error occurred while saving the page. Please try to publish the page again.", + "cx-publish-page-error": "An error occurred while publishing the translation. Please try to publish the page again. Error: $1", "cx-publish-button": "Publish translation", "cx-publish-button-publishing": "Publishing...", "cx-publish-summary": "Created by translating the page \"$1\"", diff --git a/i18n/qqq.json b/i18n/qqq.json index 2a2ded0..049b7b1 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -33,7 +33,7 @@ "cx-header-all-translations": "A link at the top of the translation interface to the main Special:ContentTranslation page that lists all translations by the user.\n{{Identical|All translations}}", "cx-source-view-page": "A link that points to the source page under the heading of the source column.\n{{Identical|View page}}", "cx-publish-page-success": "Message shown when page is published successfully. Parameters:\n* $1 - Link to the published page", - "cx-publish-page-error": "Error message to display when page saving fails.", + "cx-publish-page-error": "Error message to display when page saving fails.\n* $1 - Error details", "cx-publish-button": "Publish button text in [[Special:ContentTranslation]].\n\nAlso used in {{msg-mw|Cx-tools-instructions-text6}}.", "cx-publish-button-publishing": "Publish button text in [[Special:ContentTranslation]], shown while publishing is in progress. Replaces {{msg-mw|cx-publish-button}}.\n{{Identical|Publishing}}", "cx-publish-summary": "This is an automatic edit summary for pages that were created by [[Special:ContentTranslation]].\n\nParameters:\n* $1 - the source page name", diff --git a/modules/publish/ext.cx.publish.js b/modules/publish/ext.cx.publish.js index b658e28..de38895 100644 --- a/modules/publish/ext.cx.publish.js +++ b/modules/publish/ext.cx.publish.js @@ -289,7 +289,8 @@ * @param {object} details */ CXPublish.prototype.onFail = function ( code, details ) { - var trace = { + var trace, error; + trace = { sourceLanguage: mw.cx.sourceLanguage, targetLanguage: mw.cx.targetLanguage, sourceTitle: mw.cx.sourceTitle, @@ -305,8 +306,20 @@ this.targetTitle, JSON.stringify( details ) ); - - mw.hook( 'mw.cx.error' ).fire( mw.msg( 'cx-publish-page-error' ) ); + // Try providing useful error information. + error = mw.msg( 'unknown-error' ); + if ( details.error && details.error.info ) { + // {"servedby":"mw####","error":{"code":"blocked","info":"You have been blocked from editing", + // "*":"See .. + error = details.error.info; + } else if ( details.edit ) { + // {"result":"error","edit":{"spamblacklist":"facebook.com","result":"Failure"}} + error = JSON.stringify( details.edit ); + } else if ( details.textStatus ) { + // {"xhr":{"readyState":0,"status":0,"statusText":"timeout"},"textStatus":"timeout",... + error = details.textStatus; + } + mw.hook( 'mw.cx.error' ).fire( mw.msg( 'cx-publish-page-error', error ) ); mw.log( '[CX] Error while publishing:', code, trace ); // Enable the publish button for retry this.$trigger.prop( 'disabled', false ).text( mw.msg( 'cx-publish-button' ) ); -- To view, visit https://gerrit.wikimedia.org/r/227409 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia96ec15a4d44c7c1403542bdd1e25660984fad8b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ContentTranslation Gerrit-Branch: master Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits