Nikerabbit has uploaded a new change for review.

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

Change subject: Add some extra information to save failure logging
......................................................................

Add some extra information to save failure logging

Bug: T116908
Change-Id: If721811c39408ba28c87d7fee1387b0d3b40261b
---
M modules/draft/ext.cx.draft.js
1 file changed, 14 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/17/254817/1

diff --git a/modules/draft/ext.cx.draft.js b/modules/draft/ext.cx.draft.js
index 5141a57..64e5e83 100644
--- a/modules/draft/ext.cx.draft.js
+++ b/modules/draft/ext.cx.draft.js
@@ -316,7 +316,7 @@
         * Save the translation
         */
        ContentTranslationDraft.prototype.save = function () {
-               var targetTitle, params, apiParams,
+               var targetTitle, params, apiParams, now,
                        api = new mw.Api();
 
                if ( this.disabled ) {
@@ -347,6 +347,8 @@
 
                        return;
                }
+
+               now = Date.now();
                apiParams = $.extend( {}, params, {
                        assert: 'user',
                        action: 'cxpublish'
@@ -364,13 +366,24 @@
                                checkAndSave();
                        }, 5 * 60 * 1000 );
                } ).fail( function ( errorCode, details ) {
+                       var extra;
+
                        if ( errorCode === 'assertuserfailed' ) {
                                mw.hook( 'mw.cx.error' ).fire( mw.msg( 
'cx-lost-session-draft' ) );
                        }
+
+                       extra = {
+                               d: Date.now() - now,
+                               s: params.html.length
+                       };
+                       // Hope these will be in the beginning of the string
+                       details = $.extend( extra, details );
+
                        if ( details.exception instanceof Error ) {
                                details.exception = 
details.exception.toString();
                        }
                        details.errorCode = errorCode;
+
                        mw.hook( 'mw.cx.translation.save-failed' ).fire(
                                mw.cx.sourceLanguage,
                                mw.cx.targetLanguage,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If721811c39408ba28c87d7fee1387b0d3b40261b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <niklas.laxst...@gmail.com>

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

Reply via email to