jenkins-bot has submitted this change and it was merged.

Change subject: Add source and target languages in error message
......................................................................


Add source and target languages in error message

Add source/target languages in error messages so it can be debug better.

Change-Id: Ia6b4f8fec1739a0c975b754d0b1c434628955dcf
---
M mt/Yandex.js
M mt/Youdao.js
2 files changed, 7 insertions(+), 4 deletions(-)

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



diff --git a/mt/Yandex.js b/mt/Yandex.js
index d87f29f..f8f68de 100644
--- a/mt/Yandex.js
+++ b/mt/Yandex.js
@@ -41,7 +41,8 @@
        }
 
        if ( sourceText.length > 10000 ) {
-               return BBPromise.reject( new Error( 'Source text too long' ) );
+               return BBPromise.reject( new Error( 'Source text too long ' ) +
+                       sourceLang + '-' + targetLang );
        }
 
        sourceLang = yandexLanguageNameMap[ sourceLang ] || sourceLang;
@@ -62,7 +63,7 @@
                return response.body.text[ 0 ];
        } ).catch( function ( response ) {
                throw new Error( 'Translation with Yandex failed. Error: ' +
-                       self.getErrorName( response.body.code ) );
+                       self.getErrorName( response.body.code ) + ' ' + 
sourceLang + '-' + targetLang );
        } );
 };
 
diff --git a/mt/Youdao.js b/mt/Youdao.js
index 7f2c99b..3b18fa4 100644
--- a/mt/Youdao.js
+++ b/mt/Youdao.js
@@ -99,7 +99,8 @@
        }
 
        if ( sourceText.length > 10000 ) {
-               return BBPromise.reject( new Error( 'Source text too long' ) );
+               return BBPromise.reject( new Error( 'Source text too long ' ) +
+                       sourceLang + targetLang );
        }
 
        postData = {
@@ -120,7 +121,8 @@
                        return response.body.translation[ 0 ];
                } else {
                        throw new Error( 'Translation with Youdao failed. 
Error: ' +
-                               self.getErrorName( response.body.errorCode ) );
+                               self.getErrorName( response.body.errorCode ) +
+                                       ' ' + sourceLang + '>' + targetLang );
                }
        } );
 };

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia6b4f8fec1739a0c975b754d0b1c434628955dcf
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/services/cxserver
Gerrit-Branch: master
Gerrit-Owner: KartikMistry <kartik.mis...@gmail.com>
Gerrit-Reviewer: Nikerabbit <niklas.laxst...@gmail.com>
Gerrit-Reviewer: Santhosh <santhosh.thottin...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to